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

Incorrect exception handling in Tab Nanny #120495

Closed
Labels
type-bugAn unexpected behavior, bug, or error
@Wulian233

Description

@Wulian233

Bug report

Bug description:

In theLib/tabnanny.py module, the exception handling forIndentationError might not be reachable afterSyntaxError is caught and areturn statement is executed.
2024-06-14 195123

Seehttps://github.com/python/cpython/blob/main/Lib/tabnanny.py#L108-L114

exceptSyntaxErrorasmsg:errprint("%r: Token Error: %s"% (file,msg))returnexceptIndentationErrorasmsg:errprint("%r: Indentation Error: %s"% (file,msg))return

Why This Happens:
According tohttps://docs.python.org/3/library/exceptions.html#exception-hierarchy , we can learn thatSyntaxError detection range thanIndentationError bigger, Is the inclusion relationship.IndentationError is written afterSyntaxError, which causes the program to never executeIndentationError
IMG_20240613_211028

How to Fix:
We need to put the more specificIndentationError beforeSyntaxError

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    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