Skip to content

NameError has different actions when be raised in IDLE #135511

Open
@Locked-chess-official

Description

@Locked-chess-official

Bug report

Bug description:

In IDLE, I raised three different exceptions. The output is:

>>>raise Exception("123\n456")
Traceback (most recent call last):
  File "<pyshell#0>", line 1, in <module>
    raise Exception("123\n456")
Exception: 123
456
>>>raise NameError("123\n456")
Traceback (most recent call last):
  File "<pyshell#1>", line 1, in <module>
    raise NameError("123\n456")
456
>>>raise OSError("123\n456")
Traceback (most recent call last):
  File "<pyshell#2>", line 1, in <module>
    raise OSError("123\n456")
OSError: 123
456

Only NameError cannot show the Exception Type if the text has two or more lines.
In shell the action is same with other exception.

CPython versions tested on:

3.13

Operating systems tested on:

Windows

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    stdlibPython modules in the Lib dirtopic-IDLEtype-bugAn unexpected behavior, bug, or error

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions