Bug report
Bug description:
In the Lib/tabnanny.py module, the exception handling for IndentationError might not be reachable after SyntaxError is caught and a return statement is executed.

See https://github.com/python/cpython/blob/main/Lib/tabnanny.py#L108-L114
except SyntaxError as msg:
errprint("%r: Token Error: %s" % (file, msg))
return
except IndentationError as msg:
errprint("%r: Indentation Error: %s" % (file, msg))
return
Why This Happens:
According to https://docs.python.org/3/library/exceptions.html#exception-hierarchy , we can learn that SyntaxError detection range than IndentationError bigger, Is the inclusion relationship. IndentationError is written after SyntaxError, which causes the program to never execute IndentationError

How to Fix:
We need to put the more specific IndentationError before SyntaxError
Linked PRs
Bug report
Bug description:
In the

Lib/tabnanny.pymodule, the exception handling forIndentationErrormight not be reachable afterSyntaxErroris caught and areturnstatement 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
SyntaxErrordetection range thanIndentationErrorbigger, Is the inclusion relationship.IndentationErroris written afterSyntaxError, which causes the program to never executeIndentationErrorHow to Fix:
We need to put the more specific
IndentationErrorbeforeSyntaxErrorLinked PRs