You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
In the new REPL, multiline input execution should fail fast #128231
raiseExceptionprint("But I'm powerful enough to bypass it")
Make sure what you are seeing is:
>>> raiseException
... print("But I'm powerful enough to bypass it")
Once hit enter, the new REPL executes both statements raise Exception and print("But I'm powerful enough to bypass it") from the same, multi-line input block, despite the failure of the first one:
>>> raiseException
... print("But I'm powerful enough to bypass it")
...
Traceback (most recent call last):
File "<python-input-0>", line 1, in <module>
raise Exception
Exception
But I'm powerful enough to bypass it
This can get especially confusing if a statement defines a variable. Like
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.
Hi! Thanks for the report.
From my perspective as a someone who using REPL everyday, I'm suspect that it would stop executing after first exception.
Let's imagine the next input:
x=foo(arg) # for some reason, foo raises an exceptiony=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".
Activity
johnslavik commentedon Dec 24, 2024
Making a PR for the fix.
Eclips4 commentedon Dec 24, 2024
Hi! Thanks for the report.
From my perspective as a someone who using REPL everyday, I'm suspect that it would stop executing after first exception.
Let's imagine the next input:
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".
gh-128231: Use `runcode()` return value for failing early (GH-129488)
pythongh-128231: Use `runcode()` return value for failing early (pyth…
[3.13] gh-128231: Use `runcode()` return value for failing early (GH-…
Revert "[3.13] pythongh-128231: Use `runcode()` return value for fail…