Skip to content

Traceback module improvements #7046

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

Merged
merged 6 commits into from
Oct 13, 2022

Conversation

jepler
Copy link

@jepler jepler commented Oct 13, 2022

Since this is incompatible (in a minor way) I'd like to get it in before an 8.0 RC

More convenient traceback printing, Python 3.10 compatible

Python 3.10 added the form print_traceback(exc) to print an exception and its associated traceback. This is equivalent to print_traceback(type(exc), exc, exc.__traceback__.

CPython compatible format_traceback

Our function was documented as being compatible with CPython, which returns a list of strings. Now the implementation actually does so, rather than returning a single string. This is technically an incompatible change (vs older CircuitPython versions).

Slight size decrease

By sharing code better, a net ~16 bytes of flash memory are saved on pygamer

Tests

.. of the new way of calling, and of format_traceback.

@jepler jepler force-pushed the traceback-mod-improvements branch from 55393e5 to febc7a8 Compare October 13, 2022 14:38
@jepler jepler requested a review from dhalbert October 13, 2022 14:38
@jepler jepler added this to the 8.0.0 milestone Oct 13, 2022
Copy link
Collaborator

@dhalbert dhalbert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! The compatibility tricks certainly are 🙃 .

@dhalbert dhalbert merged commit dce4c9d into adafruit:main Oct 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants