https://github.com/python/cpython/commit/bdf0105291061f9c89b2a3d4af4f465c54c8874a
commit: bdf0105291061f9c89b2a3d4af4f465c54c8874a
branch: main
author: Stan Ulbrych <[email protected]>
committer: encukou <[email protected]>
date: 2026-03-10T09:56:00+01:00
summary:
gh-103997: Remove incorrect statements about `-c` dedenting (gh-138624)
files:
M Doc/using/cmdline.rst
M Doc/whatsnew/3.14.rst
M Include/internal/pycore_unicodeobject.h
M Misc/NEWS.d/3.14.0b1.rst
M Objects/unicodeobject.c
diff --git a/Doc/using/cmdline.rst b/Doc/using/cmdline.rst
index 84b8575284b793..cc3d2f154ed754 100644
--- a/Doc/using/cmdline.rst
+++ b/Doc/using/cmdline.rst
@@ -49,7 +49,7 @@ additional methods of invocation:
appropriately named script from that directory.
* When called with ``-c command``, it executes the Python statement(s) given as
*command*. Here *command* may contain multiple statements separated by
- newlines. Leading whitespace is significant in Python statements!
+ newlines.
* When called with ``-m module-name``, the given module is located on the
Python module path and executed as a script.
diff --git a/Doc/whatsnew/3.14.rst b/Doc/whatsnew/3.14.rst
index d4517183d697f1..772334f40a56fb 100644
--- a/Doc/whatsnew/3.14.rst
+++ b/Doc/whatsnew/3.14.rst
@@ -897,8 +897,7 @@ Command line and environment
(Contributed by Noah Kim and Adam Turner in :gh:`118655`.)
* The command-line option :option:`-c` now automatically dedents its code
- argument before execution. The auto-dedentation behavior mirrors
- :func:`textwrap.dedent`.
+ argument before execution.
(Contributed by Jon Crall and Steven Sun in :gh:`103998`.)
* :option:`!-J` is no longer a reserved flag for Jython_,
diff --git a/Include/internal/pycore_unicodeobject.h
b/Include/internal/pycore_unicodeobject.h
index af6cb84e9ff905..74d84052a2bb2b 100644
--- a/Include/internal/pycore_unicodeobject.h
+++ b/Include/internal/pycore_unicodeobject.h
@@ -326,7 +326,8 @@ extern PyObject* _PyUnicode_XStrip(
/* Dedent a string.
- Behaviour is expected to be an exact match of `textwrap.dedent`.
+ Intended to dedent Python source. Unlike `textwrap.dedent`, this
+ only supports spaces and tabs and doesn't normalize empty lines.
Return a new reference on success, NULL with exception set on error.
*/
extern PyObject* _PyUnicode_Dedent(PyObject *unicode);
diff --git a/Misc/NEWS.d/3.14.0b1.rst b/Misc/NEWS.d/3.14.0b1.rst
index 045c47ce5addc4..cb86c95a672ed7 100644
--- a/Misc/NEWS.d/3.14.0b1.rst
+++ b/Misc/NEWS.d/3.14.0b1.rst
@@ -1881,8 +1881,8 @@ Improve error message when :exc:`TypeError` occurs during
.. nonce: BS3uVt
.. section: Core and Builtins
-String arguments passed to "-c" are now automatically dedented as if by
-:func:`textwrap.dedent`. This allows "python -c" invocations to be indented
+String arguments passed to "-c" are now automatically dedented.
+This allows "python -c" invocations to be indented
in shell scripts without causing indentation errors. (Patch by Jon Crall and
Steven Sun)
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
index 7756f1a8482477..a65c43874e876c 100644
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -13581,7 +13581,8 @@ search_longest_common_leading_whitespace(
}
/* Dedent a string.
- Behaviour is expected to be an exact match of `textwrap.dedent`.
+ Intended to dedent Python source. Unlike `textwrap.dedent`, this
+ only supports spaces and tabs and doesn't normalize empty lines.
Return a new reference on success, NULL with exception set on error.
*/
PyObject *
_______________________________________________
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]