]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-130167: Add a What's New entry for changes to ``textwrap.{de,in}dent`` (#131924)
authorAdam Turner <9087854+AA-Turner@users.noreply.github.com>
Tue, 30 Dec 2025 12:57:28 +0000 (12:57 +0000)
committerGitHub <noreply@github.com>
Tue, 30 Dec 2025 12:57:28 +0000 (14:57 +0200)
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Doc/library/textwrap.rst
Doc/whatsnew/3.14.rst

index a58b460fef409c6921d6819322b846c75c20883b..3c96c0e9cc0a389de3d8a1fb4d23f937adac7856 100644 (file)
@@ -102,6 +102,10 @@ functions should be good enough; otherwise, you should use an instance of
           print(repr(s))          # prints '    hello\n      world\n    '
           print(repr(dedent(s)))  # prints 'hello\n  world\n'
 
+   .. versionchanged:: 3.14
+      The :func:`!dedent` function now correctly normalizes blank lines containing
+      only whitespace characters. Previously, the implementation only normalized
+      blank lines containing tabs and spaces.
 
 .. function:: indent(text, prefix, predicate=None)
 
index 9459b73bcb502faddfbdb37ded8e5c3821e9da78..c12a1920b107226a52526bca906e6a4bce684c27 100644 (file)
@@ -2265,6 +2265,15 @@ pdb
   (Contributed by Tian Gao in :gh:`124533`.)
 
 
+textwrap
+--------
+
+* Optimize the :func:`~textwrap.dedent` function, improving performance by
+  an average of 2.4x, with larger improvements for bigger inputs,
+  and fix a bug with incomplete normalization of blank lines with whitespace
+  characters other than space and tab.
+
+
 uuid
 ----