Skip to content

Commit 5a25936

Browse files
gpsheadclaude
andcommitted
Add open issues about timestamp collection and control flow exceptions
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>
1 parent aa4f6dc commit 5a25936

1 file changed

Lines changed: 25 additions & 0 deletions

File tree

peps/pep-08XX.rst

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,31 @@ Open Issues
356356

357357
3. Should the timestamp format be customizable beyond the predefined options?
358358

359+
4. **Always collecting timestamps vs. conditional collection**: Performance testing
360+
shows that collecting timestamps at exception instantiation time is cheap enough
361+
to do unconditionally. If we always collect them:
362+
363+
- The ``__timestamp_ns__`` attribute would always exist, simplifying the
364+
implementation and making the pickle code cleaner (though pickled exceptions
365+
would be slightly larger)
366+
- Exceptions will unpickle cleanly on older Python versions (they'll just have
367+
an extra attribute that older versions ignore)
368+
- However, we don't currently have extensive testing for cross-version pickle
369+
compatibility of exceptions with new attributes. Should we add such tests?
370+
Is this level of compatibility testing necessary?
371+
372+
5. **Control flow exception handling**: The current implementation does not collect
373+
timestamps for ``StopIteration`` and ``AsyncStopIteration`` to avoid performance
374+
impact on normal control flow. Several questions arise:
375+
376+
- Should this exclusion be configurable at runtime?
377+
- Should it apply to subclasses of these exceptions?
378+
- The check for these specific exceptions is in the hot path of exception
379+
creation and must be extremely fast. The current implementation uses a simple
380+
type check for performance. Adding complexity like subclass checks or a
381+
configurable tuple of excluded exceptions would impact performance. Is the
382+
current simple approach acceptable?
383+
359384

360385
Acknowledgements
361386
================

0 commit comments

Comments
 (0)