-
-
Notifications
You must be signed in to change notification settings - Fork 32.2k
gh-103997: Automatically dedent the argument to "-c" #103998
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
49 commits
Select commit
Hold shift + click to select a range
16be08f
Very rough proof-of-concept
Erotemic e88216b
Cleanups and comments
Erotemic bcb7c77
Fix bad decref, only trigger if command starts with a newline
Erotemic fb8985a
wchar dedent
Erotemic 26f27a8
tweaks
Erotemic 417eff8
Use new char* implementation
Erotemic 924e0a6
Rename function
Erotemic 9f95672
tweaks
Erotemic 3f4a78b
More tweaks
Erotemic 97f2079
Replace strncmp with direct char comparison
Erotemic 04435eb
Remove debug code
Erotemic 4c4eca9
Made new function static
Erotemic f9c969b
Handwritten char iter and _PyBytesWriter_
Erotemic 674f1e0
reimplement it to imitate `textwrap.dedent`
sunmy2019 05d4169
fix missing initialization
sunmy2019 9d53c4e
fix ref leak
sunmy2019 689a13a
fix empty string
sunmy2019 f0ac7ea
nit: remove unnecessary variable
sunmy2019 71cad01
remove unnecessary include
sunmy2019 4549de8
Add test cases
Erotemic 0c3b90b
Fix test on windows
Erotemic 1f5b746
normalize windows line endings
Erotemic ca40589
Merge branch 'main' into dedent_pymain_command
Erotemic 1f17e23
Update Modules/main.c
sunmy2019 2de2e1e
Merge branch 'python:main' into dedent_pymain_command
sunmy2019 c84616c
refactor code
sunmy2019 a19b675
Apply suggestions from code review
sunmy2019 7ce411f
Update Misc/NEWS.d/next/Core and Builtins/2023-04-29-23-15-38.gh-issu…
sunmy2019 dea4301
resolve comments
sunmy2019 e06d40c
Update Modules/main.c
sunmy2019 a40d028
rename `out` to `dest`
sunmy2019 9569655
move to _PyUnicode_Dedent
sunmy2019 1735d0f
Apply suggestions from code review
sunmy2019 d3681b7
clean up things
sunmy2019 3b4a7bc
Merge branch 'main' into dedent_pymain_command
Erotemic f355760
Merge branch 'main' into dedent_pymain_command
Erotemic b1e89c9
Merge branch 'main' into dedent_pymain_command
AA-Turner d1b4cd1
Update Misc/NEWS.d/next/Core and Builtins/2023-04-29-23-15-38.gh-issu…
Erotemic e556bbf
lint: space in folder name
Erotemic 136c8b0
Explicit include of pycore_unicodeobject.h
Erotemic 8e5cc7f
Merge branch 'main' into dedent_pymain_command
Erotemic cd14a00
Apply suggestions from code review
sunmy2019 07d2273
Resolve Comments
sunmy2019 ed6e17b
Refactor implementation
sunmy2019 d1edb1b
Merge branch 'main' into dedent_pymain_command
sunmy2019 4c78c57
Apply suggestions from code review
methane 38d2a4e
add what's new entry
methane 42b6330
Document dedentation of command in version 3.14
methane 98c17e5
Apply suggestions from code review
picnixz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
Misc/NEWS.d/next/Core_and_Builtins/2023-04-29-23-15-38.gh-issue-103997.BS3uVt.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
String arguments passed to "-c" are now automatically dedented as if by | ||
picnixz marked this conversation as resolved.
Show resolved
Hide resolved
|
||
:func:`textwrap.dedent`. This allows "python -c" invocations to be indented | ||
picnixz marked this conversation as resolved.
Show resolved
Hide resolved
|
||
in shell scripts without causing indentation errors. (Patch by Jon Crall and | ||
Steven Sun) | ||
picnixz marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.