Skip to content

gh-150732: Handle SystemError from compiler in the REPLs - #151480

Open
johnslavik wants to merge 4 commits into
python:mainfrom
johnslavik:gh-150732-incompleteinputerror-is-leaked-in-the-repl-if-inpu
Open

johnslavik wants to merge 4 commits into
python:mainfrom
johnslavik:gh-150732-incompleteinputerror-is-leaked-in-the-repl-if-inpu

Conversation

@johnslavik

@johnslavik johnslavik commented Jun 14, 2026 •

Copy link
Copy Markdown
Member

Try >>> class C: [(lambda: __class__)() for () in ()] at rev 5804991 or earlier as the prompt to reproduce organically at upstream.

This covers cases in our REPLs when the compiler raises SystemError, e.g. because it has a bug.

@johnslavik johnslavik added needs backport to 3.14 bugs and security fixes needs backport to 3.15 pre-release feature fixes, bugs and security fixes labels Jun 14, 2026
Comment thread Lib/codeop.py
compiler(source + "\n", filename, symbol, flags=flags)
return None
except _IncompleteInputError:
except _IncompleteInputError, SystemError:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Won't this just hide a SystemError?

Comment thread Lib/codeop.py
@@ -147,8 +147,8 @@ def __call__(self, source, filename="<input>", symbol="single"):

- Return a code object if the command is complete and valid
- Return None if the command is incomplete

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

But we return None, no? Also, this docstring is repeated in several places, all of them would need updating.

@johnslavik johnslavik left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This doesn't cover pdb. Currently, pdb will run into postmortem from the failing compilation of prompt.

@github-actions

Copy link
Copy Markdown

This PR is stale because it has been open for 90 days with no activity.

@github-actions github-actions Bot added the stale Stale PR or inactive for long period of time. label Sep 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting review needs backport to 3.14 bugs and security fixes needs backport to 3.15 pre-release feature fixes, bugs and security fixes stale Stale PR or inactive for long period of time.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants