Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 35.2k
gh-132502: Implements PEP-830 adding timestamps to tracebacks#129337
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
base:main
Are you sure you want to change the base?
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
c5a9ccd3dc00c2a05766fcdb67f099ffc8ac119a02bcc720bb06539409a547adaa752de7fab86e8a629768094260d834477c83ebfbeadfb8354c5f033d20dd2f723237f7357dd9d2b1f98b4593c9ad56d53b55008043b8075072cbeebec1d9ff3234f30c74d85496cf9c8eda46949cbab564e63e6199e34c031a623e253898ae94f7d45424dde0f395f7b930964bdd35554b670f9bb1ba55c3b1d2d758384989bbb268c82d0f95ba52a1e2505d6f131fc9c884aaa4dcec22c191b83faf1ba3ed41efbc2abab357577ffb5aa0656cee4f54d4ad6bef80d5723dd9f6500a0d66037d2a4d3d617d83cbd5c4c3813d9ec9ce9f8afa13d45e812691a44bc4aa971bc13fa0d146bbb874c838a2681948c37be65526720999bb8e7cFile filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -159,6 +159,41 @@ The following exceptions are used mostly as base classes for other exceptions. | ||
| .. versionadded:: 3.11 | ||
| .. attribute:: __timestamp_ns__ | ||
| The absolute UTC time in nanoseconds at which this exception was | ||
| instantiated (usually: when it was raised), with the same accuracy and | ||
| epoch as :func:`time.time_ns`. | ||
| Collection and display of these timestamps after the exception message in | ||
| tracebacks is off by default but can be configured using the | ||
| :envvar:`PYTHON_TRACEBACK_TIMESTAMPS` environment variable or the | ||
gpshead marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| :option:`-X traceback_timestamps <-X>` command line option. In | ||
gpshead marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| applications with complicated exception chains and exception groups it | ||
| may be useful to help understand what happened when. | ||
| The value is ``0`` when a timestamp was not recorded. | ||
| :exc:`StopIteration` and :exc:`StopAsyncIteration` never record | ||
| timestamps as they are used primarily for control flow. | ||
| This attribute does not affect the result of :func:`str` or :func:`repr` | ||
| on the exception. | ||
| With ``PYTHON_TRACEBACK_TIMESTAMPS=iso`` in the environment :: | ||
gpshead marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| Traceback (most recent call last): | ||
| File "<python-input-0>", line 1, in <module> | ||
| raise RuntimeError("example") | ||
| RuntimeError: example <@2025-02-08T01:21:28.675309Z> | ||
| With ``PYTHON_TRACEBACK_TIMESTAMPS=ns`` in the environment :: | ||
| Traceback (most recent call last): | ||
| File "<python-input-0>", line 1, in <module> | ||
| raise RuntimeError("example") | ||
| RuntimeError: example <@1739172733.527638530> | ||
| .. versionadded:: next | ||
| .. exception:: Exception | ||
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.