too wide source positions for exceptions during pattern matching (3.11.0rc2) #96999
Labels
interpreter-core
(Objects, Python, Grammar, and Parser dirs)
type-bug
An unexpected behavior, bug, or error
The source range in the traceback is to wide in some cases, if an exception is thrown during matching of a pattern.
The Ranges
example for attribute lookup:
output (Python 3.11.0rc2+):
Annotating only the source positions where the attribute check failed (
banana=7
) would make the traceback easier to read.The same problem exists for positional matching:
output (Python 3.11.0rc2+):
Equality checks are handled better:
output (Python 3.11.0rc2+):
Instance checks are represented in the same way:
output (Python 3.11.0rc2+):
Problem for the User
Consistent source ranges would improve the readability of the tracebacks.
Is it possible to highlight always only the failing Pattern (with attribute name if given) for failing attribute access?
example:
Instance checks and equality tests are already handled well:
Problem for libraries
Libraries are using the source ranges for all sorts of functionality.
Executing for example is using this ranges (for the new 3.11 support) to map from instructions back to ast-nodes. Useful ranges are here required to map to useful ast-nodes.
The text was updated successfully, but these errors were encountered: