Skip to content
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

Update Standard Library sys documentation #9427

Merged
merged 4 commits into from
Jul 23, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 15 additions & 14 deletions docs/library/sys.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,21 @@ Functions
function raise as `SystemExit` exception. If an argument is given, its
value given as an argument to `SystemExit`.

.. function:: print_exception(exc, file=sys.stdout, /)

Print exception with a traceback to a file-like object *file* (or
`sys.stdout` by default).

.. admonition:: Difference to CPython
:class: attention

This is simplified version of a function which appears in the
``traceback`` module in CPython. Unlike ``traceback.print_exception()``,
this function takes just exception value instead of exception type,
exception value, and traceback object; *file* argument should be
positional; further arguments are not supported. CPython-compatible
``traceback`` module can be found in `micropython-lib`.
RetiredWizard marked this conversation as resolved.
Show resolved Hide resolved
RetiredWizard marked this conversation as resolved.
Show resolved Hide resolved

Constants
---------

Expand Down Expand Up @@ -97,12 +112,6 @@ Constants
If you need to check whether your program runs on CircuitPython (vs other
Python implementation), use `sys.implementation` instead.

.. data:: ps1
ps2

Mutable attributes holding strings, which are used for the REPL prompt. The defaults
give the standard Python prompt of ``>>>`` and ``...``.

.. data:: stderr

Standard error ``stream``.
Expand All @@ -115,14 +124,6 @@ Constants

Standard output ``stream``.

.. data:: tracebacklimit

A mutable attribute holding an integer value which is the maximum number of traceback
entries to store in an exception. Set to 0 to disable adding tracebacks. Defaults
to 1000.

Note: this is not available on all ports.

.. data:: version

Python language version that this implementation conforms to, as a string.
Expand Down