Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

In the new REPL, multiline input execution should fail fast #128231

Closed
Labels
3.13bugs and security fixes3.14bugs and security fixestopic-replRelated to the interactive shelltype-bugAn unexpected behavior, bug, or error
@bswck

Description

@bswck

Bug report

Bug description:

To reproduce, simply paste this to the new REPL:

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 statementsraise Exception andprint("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 ExceptionExceptionBut I'm powerful enough to bypass it

This can get especially confusing if a statement defines a variable. Like

>>> n=1/0...print(k-n)

causing

Traceback (mostrecentcalllast):File"<python-input-0>",line1,in<module>n=1/0~~^~~ZeroDivisionError:divisionbyzeroTraceback (mostrecentcalllast):File"<python-input-0>",line2,in<module>print(k-n)^NameError:name'k'isnotdefined

I'd expect different behavior: since those two statements belong to the same input, it is more logical for them to behave like asuite, 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.13bugs and security fixes3.14bugs and security fixestopic-replRelated to the interactive shelltype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp