Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 34k
Closed
Labels
3.11only security fixesonly security fixes3.12only security fixesonly security fixes3.13bugs and security fixesbugs and security fixesinterpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
Bug report
Bug description:
Hi.
I noticed that using add_note() with an error of type SyntaxError (or its derived such as IndentationError and TabError) produces a traceback without the expected notes.
Here is a minimal reproducible example:
try: exec("a = 7 *") exceptSyntaxErrorase: e.add_note("Note") raiseOr alternatively:
e=SyntaxError("invalid syntax", ("<string>", 1, 8, "a = 7 *\n", 1, 8)) e.add_note("Note") raiseeThe output of these examples is:
Traceback (mostrecentcalllast): File"/home/delgan/test.py", line2, in<module>exec("a = 7 *") File"<string>", line1a=7*^SyntaxError: invalidsyntaxThe expected "Note" is missing.
Since neither PEP 678 nor the documentation mention that SyntaxError is not fully compatible with notes, I assume that this is probably a bug.
CPython versions tested on:
3.11, 3.12
Operating systems tested on:
Linux
Linked PRs
iritkatriel
Metadata
Metadata
Assignees
Labels
3.11only security fixesonly security fixes3.12only security fixesonly security fixes3.13bugs and security fixesbugs and security fixesinterpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error