-
-
Notifications
You must be signed in to change notification settings - Fork 30k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Incorrect exception handling in Tab Nanny #120495
Labels
type-bug
An unexpected behavior, bug, or error
Comments
Wulian233
changed the title
Incorrect Exception Handling in
Incorrect exception handling in Tab Nanny
Jun 14, 2024
tabnanny.py
hugovk
added a commit
that referenced
this issue
Jun 15, 2024
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
miss-islington
pushed a commit
to miss-islington/cpython
that referenced
this issue
Jun 15, 2024
…nGH-120498) (cherry picked from commit c501261) Co-authored-by: Wulian233 <71213467+Wulian233@users.noreply.github.com> Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
miss-islington
pushed a commit
to miss-islington/cpython
that referenced
this issue
Jun 15, 2024
…nGH-120498) (cherry picked from commit c501261) Co-authored-by: Wulian233 <71213467+Wulian233@users.noreply.github.com> Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
mrahtz
pushed a commit
to mrahtz/cpython
that referenced
this issue
Jun 30, 2024
…n#120498) Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
noahbkim
pushed a commit
to hudson-trading/cpython
that referenced
this issue
Jul 11, 2024
…n#120498) Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
estyxx
pushed a commit
to estyxx/cpython
that referenced
this issue
Jul 17, 2024
…n#120498) Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Bug report
Bug description:
In the
Lib/tabnanny.py
module, the exception handling forIndentationError
might not be reachable afterSyntaxError
is caught and areturn
statement is executed.See https://github.com/python/cpython/blob/main/Lib/tabnanny.py#L108-L114
Why This Happens:
According to https://docs.python.org/3/library/exceptions.html#exception-hierarchy , we can learn that
SyntaxError
detection range thanIndentationError
bigger, Is the inclusion relationship.IndentationError
is written afterSyntaxError
, which causes the program to never executeIndentationError
How to Fix:
We need to put the more specific
IndentationError
beforeSyntaxError
Linked PRs
The text was updated successfully, but these errors were encountered: