Skip to content
Open
Changes from all commits
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
24 changes: 12 additions & 12 deletions peps/pep-0830.rst
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ Display Format
Timestamps are appended to the exception message line in tracebacks using
the format ``<@timestamp>``. Example with ``iso``:

.. code-block:: text
.. code-block:: pytb

Traceback (most recent call last):
File "<stdin>", line 3, in california_raisin
Expand Down Expand Up @@ -208,7 +208,7 @@ occasional varying 1-2% measurement noise that could not be reliably
reproduced. Below the benchmarking setup noise threshold as far as the author
is concerned.

What about the special case performance optimiaztion? If I omit the two line
What about the special case performance optimization? If I omit the two-line
special case to avoid collecting timestamps on ``StopIteration`` and
``StopAsyncIteration`` in ``Objects/exception.c``, only a single benchmark
showed a regression: ``async_generators``. That one would reliably run on the
Expand All @@ -219,7 +219,7 @@ demonstrates the importance of that optimization.
I used ``configure --enable-optimizations`` builds for my benchmarks and ran
them using commands such as:

.. code-block:: text
.. code-block:: shell

pyperformance run -p baseline-3a7df632c96/build/python -o baseline-eopt.json
pyperformance run -p traceback-timestamps/build/python -o traceback-timestamps-default-eopt.json
Expand Down Expand Up @@ -250,30 +250,30 @@ Pickled Exception Examples

With traceback timestamp collection enabled:

.. code-block:: text
.. code-block:: console

build/python -X traceback_timestamps=iso -c 'import pickle; print(pickle.dumps(RuntimeError("pep-830"), protocol=pickle.HIGHEST_PROTOCOL))'
$ build/python -X traceback_timestamps=iso -c 'import pickle; print(pickle.dumps(RuntimeError("pep-830"), protocol=pickle.HIGHEST_PROTOCOL))'
b'\x80\x05\x95L\x00\x00\x00\x00\x00\x00\x00\x8c\x08builtins\x94\x8c\x0cRuntimeError\x94\x93\x94\x8c\x07pep-830\x94\x85\x94R\x94}\x94\x8c\x10__timestamp_ns__\x94\x8a\x08\xf4\xd8\x94`\x15\xaf\xa5\x18sb.'

The special case for ``StopIteration`` means it does not carry the dict with timestamp data:

.. code-block:: text
.. code-block:: console

build/python -X traceback_timestamps=iso -c 'import pickle; print(pickle.dumps(StopIteration("pep-830"), protocol=pickle.HIGHEST_PROTOCOL))'
$ build/python -X traceback_timestamps=iso -c 'import pickle; print(pickle.dumps(StopIteration("pep-830"), protocol=pickle.HIGHEST_PROTOCOL))'
b'\x80\x05\x95,\x00\x00\x00\x00\x00\x00\x00\x8c\x08builtins\x94\x8c\rStopIteration\x94\x93\x94\x8c\x07pep-830\x94\x85\x94R\x94.'

Nor do exceptions carry the timestamp when the feature is disabled (the default):

.. code-block:: text
.. code-block:: console

build/python -X traceback_timestamps=0 -c 'import pickle; print(pickle.dumps(RuntimeError("pep-830"), protocol=pickle.HIGHEST_PROTOCOL))'
$ build/python -X traceback_timestamps=0 -c 'import pickle; print(pickle.dumps(RuntimeError("pep-830"), protocol=pickle.HIGHEST_PROTOCOL))'
b'\x80\x05\x95+\x00\x00\x00\x00\x00\x00\x00\x8c\x08builtins\x94\x8c\x0cRuntimeError\x94\x93\x94\x8c\x07pep-830\x94\x85\x94R\x94.'

Which matches what Python 3.13 produces:

.. code-block:: text
.. code-block:: console

python3.13 -c 'import pickle; print(pickle.dumps(RuntimeError("pep-830"), protocol=pickle.HIGHEST_PROTOCOL))'
$ python3.13 -c 'import pickle; print(pickle.dumps(RuntimeError("pep-830"), protocol=pickle.HIGHEST_PROTOCOL))'
b'\x80\x05\x95+\x00\x00\x00\x00\x00\x00\x00\x8c\x08builtins\x94\x8c\x0cRuntimeError\x94\x93\x94\x8c\x07pep-830\x94\x85\x94R\x94.'

Maintenance Burden
Expand Down Expand Up @@ -397,7 +397,7 @@ Acknowledgements
================

Thanks to Nathaniel J. Smith for the original idea suggestion, and to
``@dcolascione`` for initial 2025 review feedback on the implementation.
Daniel Colascione for initial 2025 review feedback on the implementation.


Change History
Expand Down
Loading