Skip to content

gh-118158: Fix missing newline in py_compile CLI error output#149008

Open
yuanx749 wants to merge 4 commits into
python:mainfrom
yuanx749:py-compile-newline
Open

gh-118158: Fix missing newline in py_compile CLI error output#149008
yuanx749 wants to merge 4 commits into
python:mainfrom
yuanx749:py-compile-newline

Conversation

@yuanx749
Copy link
Copy Markdown
Contributor

@yuanx749 yuanx749 commented Apr 26, 2026

Fix gh-118158.

The old main() added a trailing newline to error messages (bpo-23811), which was lost when it was refactored to use argparse.

The issue is still reproducible on main. Since this was reported about two years ago and there did not appear to be a PR, I went ahead and opened this fix.

Copy link
Copy Markdown

@sepehr-rs sepehr-rs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can confirm the fix works:

sepehr@debian:~$ ./python -m py_compile test.py
Sorry: IndentationError: unexpected indent (test.py, line 1)
sepehr@debian:~$ 

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don’t think it’s standard to add Contributed by in the news entry, and I haven’t seen other CPython issues doing that. But I’ve only started contributing here recently, so I could be missing some context.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

py_compile CLI error message missing newline

2 participants