]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-103997: Remove incorrect statements about `-c` dedenting (gh-138624)
authorStan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Tue, 10 Mar 2026 08:56:00 +0000 (08:56 +0000)
committerGitHub <noreply@github.com>
Tue, 10 Mar 2026 08:56:00 +0000 (09:56 +0100)
Doc/using/cmdline.rst
Doc/whatsnew/3.14.rst
Include/internal/pycore_unicodeobject.h
Misc/NEWS.d/3.14.0b1.rst
Objects/unicodeobject.c

index 84b8575284b79349108d2829954bff4a9429f5c4..cc3d2f154ed754a570099a6f0320bb608bb49f6c 100644 (file)
@@ -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.
 
index d4517183d697f1ff5bb284edff27685ad91adf97..772334f40a56fb58c40903d93ab0dbe7bd934a85 100644 (file)
@@ -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_,
index af6cb84e9ff905715e9ee982df3d7738dc88c02b..74d84052a2bb2be8b7f60cdfef3ee11227982cf9 100644 (file)
@@ -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);
index 045c47ce5addc44a9662b13ab8fc5ca858c5443b..cb86c95a672ed720132508be89dd451cc8a8bac9 100644 (file)
@@ -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)
 
index 7756f1a84824777752c74edbfeac4c13024c2056..a65c43874e876c4dd87bbdd53d2032bea1f65fab 100644 (file)
@@ -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 *