Skip to content

Commit 7e3a5a7

Browse files
AA-TurnerStanFromIrelandpicnixzhugovk
authored
gh-130167: Add a What's New entry for changes to textwrap.{de,in}dent (#131924)
Co-authored-by: Stan Ulbrych <[email protected]> Co-authored-by: Bénédikt Tran <[email protected]> Co-authored-by: Hugo van Kemenade <[email protected]>
1 parent 0aedf2f commit 7e3a5a7

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

Doc/library/textwrap.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,10 @@ functions should be good enough; otherwise, you should use an instance of
102102
print(repr(s)) # prints ' hello\n world\n '
103103
print(repr(dedent(s))) # prints 'hello\n world\n'
104104

105+
.. versionchanged:: 3.14
106+
The :func:`!dedent` function now correctly normalizes blank lines containing
107+
only whitespace characters. Previously, the implementation only normalized
108+
blank lines containing tabs and spaces.
105109

106110
.. function:: indent(text, prefix, predicate=None)
107111

Doc/whatsnew/3.14.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2265,6 +2265,15 @@ pdb
22652265
(Contributed by Tian Gao in :gh:`124533`.)
22662266

22672267

2268+
textwrap
2269+
--------
2270+
2271+
* Optimize the :func:`~textwrap.dedent` function, improving performance by
2272+
an average of 2.4x, with larger improvements for bigger inputs,
2273+
and fix a bug with incomplete normalization of blank lines with whitespace
2274+
characters other than space and tab.
2275+
2276+
22682277
uuid
22692278
----
22702279

0 commit comments

Comments
 (0)