`NameError` has different actions when be raised in IDLE
Open
Nobody has claimed this yet.
topic-IDLE
type-bug
- Dominant language
- Python
- Stars
- 77.2k
- Forks
- 35.9k
- PR merge metrics
- PR metrics pending
Description
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
- gh-135526
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the three exception cases in the IDLE shell on Python 3.13 and compare them with the regular shell output. Trace how IDLE formats multiline exception messages, then verify that a multiline NameError displays its exception type consistently with Exception and OSError; linked PR gh-135526 indicates work is already underway.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- desktop
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100