Skip to content

Conversation

@thmo
Copy link
Contributor

@thmo thmo commented Jan 19, 2021

As part of python/cpython#23113 partly
implementing PEP 626 (see https://bugs.python.org/issue42246), the
co_lnotab member of struct PyCodeObject was replaced by co_linetable,
implementing a new line number table.

This commit therefore adds linetable to the list of attributes that
are copied over into the final CodeType executed by fake_traceback()
to ensure proper line numbers and contents in fake stack traces
generated when running under Python 3.10.

Fixes #1333.

thmo and others added 2 commits January 19, 2021 18:05
As part of python/cpython#23113 partly
implementing PEP 626 (see https://bugs.python.org/issue42246), the
co_lnotab member of struct PyCodeObject was replaced by co_linetable,
implementing a new line number table.

This commit therefore adds linetable to the list of attributes that
are copied over into the final CodeType executed by fake_traceback()
to ensure proper line numbers and contents in fake stack traces
generated when running under Python 3.10.

Fixes pallets#1333.
@davidism davidism added this to the 3.0.0 milestone Jan 19, 2021
@davidism davidism merged commit 5f79ba6 into pallets:master Jan 19, 2021
@thmo thmo deleted the issue1333 branch January 19, 2021 20:05
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 3, 2021
@davidism
Copy link
Member

davidism commented Nov 9, 2021

Not sure why I merged this at the time, but this didn't actually fix things. First, the lnotab arg was renamed to linetable, so it should not have been added to the end of the list. Second, the co_lnotab attr still exists, so this was actually creating a list with one too many args in it.

The fact that everything passed was due to the try/except Exception block around the entire thing. This wasn't actually generating the correct CodeType object.

See #1535

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Test suite failures with Python 3.10.0a4

2 participants