https://github.com/python/cpython/commit/7e3a5a7e791b742a74c64810f221854191b94c1f
commit: 7e3a5a7e791b742a74c64810f221854191b94c1f
branch: main
author: Adam Turner <[email protected]>
committer: hugovk <[email protected]>
date: 2025-12-30T14:57:28+02:00
summary:
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]>
files:
M Doc/library/textwrap.rst
M Doc/whatsnew/3.14.rst
diff --git a/Doc/library/textwrap.rst b/Doc/library/textwrap.rst
index a58b460fef409c..3c96c0e9cc0a38 100644
--- a/Doc/library/textwrap.rst
+++ b/Doc/library/textwrap.rst
@@ -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)
diff --git a/Doc/whatsnew/3.14.rst b/Doc/whatsnew/3.14.rst
index 9459b73bcb502f..c12a1920b10722 100644
--- a/Doc/whatsnew/3.14.rst
+++ b/Doc/whatsnew/3.14.rst
@@ -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
----
_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]