-
-
Notifications
You must be signed in to change notification settings - Fork 32k
In the new REPL, multiline input execution should fail fast #128231
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
Labels
3.13
bugs and security fixes
3.14
bugs and security fixes
topic-repl
Related to the interactive shell
type-bug
An unexpected behavior, bug, or error
Comments
Making a PR for the fix. |
Hi! Thanks for the report. x = foo(arg) # for some reason, foo raises an exception
y = x * 10 # Would fail with NameError I'm think that usually lines of code in code blocks are related and depends on each other, so I'm in favor of changing current behavior to "fail on first exception". |
encukou
pushed a commit
that referenced
this issue
Feb 24, 2025
miss-islington
pushed a commit
to miss-islington/cpython
that referenced
this issue
Feb 24, 2025
…onGH-129488) (cherry picked from commit 7ed3dc6) Co-authored-by: Bartosz Sławecki <[email protected]>
hugovk
pushed a commit
that referenced
this issue
Mar 28, 2025
hugovk
added a commit
to hugovk/cpython
that referenced
this issue
Mar 28, 2025
…ing early (pythonGH-129488) (python#130513)" This reverts commit 8f6a9aa.
This was referenced Mar 28, 2025
seehwan
pushed a commit
to seehwan/cpython
that referenced
this issue
Apr 16, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
3.13
bugs and security fixes
3.14
bugs and security fixes
topic-repl
Related to the interactive shell
type-bug
An unexpected behavior, bug, or error
Bug report
Bug description:
To reproduce, simply paste this to the new REPL:
Make sure what you are seeing is:
Once hit enter, the new REPL executes both statements
raise Exception
andprint("But I'm powerful enough to bypass it")
from the same, multi-line input block, despite the failure of the first one:This can get especially confusing if a statement defines a variable. Like
causing
I'd expect different behavior: since those two statements belong to the same input, it is more logical for them to behave like a suite, where the consecutive execution of a statement depends on a successful completion of the one before it.
CPython versions tested on:
3.13, 3.14
Operating systems tested on:
Linux, macOS, Windows
Linked PRs
runcode()
return value for failing early #129488runcode()
return value for failing early (GH-129488) #130513runcode()
return value for failing early (GH-129488) (#130513)" #131834runcode()
return value for failing early (fix test) #131835The text was updated successfully, but these errors were encountered: