-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
PEP 9999: Add timestamps to exception tracebacks #4592
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
Draft
Draft
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This draft PEP proposes adding optional timestamps to Python exception objects that can be displayed in tracebacks. Based on CPython PR #129337 by Gregory P. Smith. The feature adds a __timestamp_ns__ attribute to BaseException and allows configuration via environment variables or command-line options. This is particularly useful for debugging async applications with exception groups and distributed systems. 🤖 Generated with Claude Code (https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
@AA-Turner
AA-Turner
changed the title
(削除) PEP-8XX: Add timestamps to exception tracebacks (削除ここまで)
(追記) PEP 8XX: Add timestamps to exception tracebacks (追記ここまで)
Sep 17, 2025
@AA-Turner
AA-Turner
changed the title
(削除) PEP 8XX: Add timestamps to exception tracebacks (削除ここまで)
(追記) PEP 9999: Add timestamps to exception tracebacks (追記ここまで)
Sep 17, 2025
Added two important open issues to the PEP: 1. Whether to always collect timestamps unconditionally (performance testing shows it's cheap) and the implications for pickle size and cross-version compatibility testing 2. Configuration of control flow exception exclusions (StopIteration, AsyncStopIteration) and whether subclasses should be included, noting the performance constraints of the hot path 🤖 Generated with Claude Code (https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
@gpshead
gpshead
changed the title
(削除) PEP 9999: Add timestamps to exception tracebacks (削除ここまで)
(追記) PEP 8XX: Add timestamps to exception tracebacks (追記ここまで)
Sep 17, 2025
@gpshead
gpshead
changed the title
(削除) PEP 8XX: Add timestamps to exception tracebacks (削除ここまで)
(追記) PEP 9999: Add timestamps to exception tracebacks (追記ここまで)
Sep 17, 2025
Added two new sections to address questions raised at core team sprint: 1. "Why Exception Groups Need Timestamps" - Explains that while exception groups are conceptually unrelated, in practice they have important temporal relationships for debugging causality, performance analysis, and correlation with external observability tools. 2. "Why Not Use .add_note() When Catching?" - Details six key drawbacks of using add_note() instead: not all exceptions are caught, timing accuracy issues, inconsistent application, performance overhead, complexity burden, and loss of original timing information. Key insight: When an exception occurs is intrinsic, immutable information that should be captured at the source, not added later by consumers. 🤖 Generated with Claude Code (https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
... need Based on feedback from @picnixz about Sphinx's Skip exception and other projects using exceptions for control flow: 1. Renamed "Special Cases" to "Control Flow Exceptions" for clarity 2. Added acknowledgment that other projects need this configurability 3. Deferred specific API design to open issues 4. Updated Open Issue python#5 with key challenges: - API design options (env var vs Python API) - Performance constraints in the hot path - Subclass handling complexity - Whether to expand the default exclusion list The PEP now acknowledges the need for configurability while leaving the specific implementation approach as an open question requiring careful API design and performance testing. 🤖 Generated with Claude Code (https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
This draft PEP proposes adding optional timestamps to Python exception objects that can be displayed in tracebacks. Based on CPython PR #129337 by Gregory P. Smith.
The feature adds a
__timestamp_ns__attribute to BaseException and allows configuration via environment variables or command-line options. This is particularly useful for debugging async applications with exception groups and distributed systems.🤖 Generated with Claude Code (https://claude.ai/code)
[to be discussed at the ongoing cambridge core team sprint. discussed in room, now to go get some better motivation description and start a discuss thread to flesh this out] -gpshead
📚 Documentation preview 📚: https://pep-previews--4592.org.readthedocs.build/