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

Notes added to "SyntaxError" (and subclasses) are not displayed #109179

Closed
Labels
3.11only security fixes3.12only security fixes3.13bugs and security fixesinterpreter-core(Objects, Python, Grammar, and Parser dirs)type-bugAn unexpected behavior, bug, or error
@Delgan

Description

@Delgan

Bug report

Bug description:

Hi.

I noticed that usingadd_note() with an error of typeSyntaxError (or its derived such asIndentationError andTabError) produces a traceback without the expected notes.

Here is a minimal reproducible example:

try:exec("a = 7 *")exceptSyntaxErrorase:e.add_note("Note")raise

Or alternatively:

e=SyntaxError("invalid syntax", ("<string>",1,8,"a = 7 *\n",1,8))e.add_note("Note")raisee

The output of these examples is:

Traceback (mostrecentcalllast):File"/home/delgan/test.py",line2,in<module>exec("a = 7 *")File"<string>",line1a=7*^SyntaxError:invalidsyntax

The expected"Note" is missing.

Since neither PEP 678 nor the documentation mention thatSyntaxError 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.11only security fixes3.12only security fixes3.13bugs and security fixesinterpreter-core(Objects, Python, Grammar, and Parser dirs)type-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