Skip to content

sys: remove nonstandard print_exception #9446

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

Closed
wants to merge 3 commits into from

Conversation

jepler
Copy link

@jepler jepler commented Jul 22, 2024

CircuitPython provides this at exception.print_exception(), with improved compatibility with standard Python.

This is an alternative to #9427, which adds documentation for the non-standard function.

One reason NOT to take this change is that the traceback module is not built on samd21s, leaving non-standard sys.print_exception as the only way to print an exception object (besides raising it)

jepler added 2 commits July 22, 2024 15:35
CircuitPython provides this at `exception.print_exception()`, with
improved compatibility with standard Python.
@dhalbert
Copy link
Collaborator

I looked in the bundle and in the Learn Guide code, and sys.print_exception() is only used in code that runs on larger boards. It is used, so the few places it's used should be fixed to used traceback.

libraries/drivers/mcp2515/examples/mcp2515_canio_test.py
libraries/helpers/debouncer/examples/debouncer_unittest.py

@dhalbert
Copy link
Collaborator

I think I am OK with samd21 not being able to print tracebacks "manually". There are so many other things limited in that port, this is not such a big deal. You can still print info about the exception.

@tannewt
Copy link
Member

tannewt commented Jul 22, 2024

Let's remove in CP10 and add a FutureWarning now because code can be moved to traceback now. (I assume traceback is in 8.x too.)

@jepler
Copy link
Author

jepler commented Jul 23, 2024

OK I'll close this up but leave the branch.

@jepler jepler closed this Jul 23, 2024
@jepler
Copy link
Author

jepler commented Jul 23, 2024

@tannewt
Copy link
Member

tannewt commented Jul 23, 2024

@jepler Can you add the warning? RetiredWizard's PR only updates the docs.

@RetiredWizard
Copy link

Great minds think alike.... 😁 #9450

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.

4 participants