Skip to content

sys: remove nonstandard print_exception#9446

Closed
jepler wants to merge 3 commits into
adafruit:mainfrom
jepler:remove-sys-exception
Closed

sys: remove nonstandard print_exception#9446
jepler wants to merge 3 commits into
adafruit:mainfrom
jepler:remove-sys-exception

Conversation

@jepler
Copy link
Copy Markdown

@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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Author

jepler commented Jul 23, 2024

@tannewt
Copy link
Copy Markdown
Member

tannewt commented Jul 23, 2024

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

@RetiredWizard
Copy link
Copy Markdown

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