Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Doc/using/cmdline.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
3 changes: 1 addition & 2 deletions Doc/whatsnew/3.14.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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_,
Expand Down
3 changes: 2 additions & 1 deletion Include/internal/pycore_unicodeobject.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions Misc/NEWS.d/3.14.0b1.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
3 changes: 2 additions & 1 deletion Objects/unicodeobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 *
Expand Down
Loading