Skip to content

Fix pickling of BaseExceptionGroup instances - #95

Open
yqia03 wants to merge 1 commit into
ionelmc:masterfrom
yqia03:fix/base-exception-group-pickling
Open

yqia03 wants to merge 1 commit into
ionelmc:masterfrom
yqia03:fix/base-exception-group-pickling

Conversation

@yqia03

@yqia03 yqia03 commented Nov 15, 2026

Copy link
Copy Markdown

Summary

- preserve constructor arguments for ExceptionGroup
+ preserve constructor arguments for BaseExceptionGroup (including ExceptionGroup)

A BaseExceptionGroup containing KeyboardInterrupt can be pickled by the standard library, but fails to unpickle after tblib.pickling_support.install() with TypeError: BaseExceptionGroup.__new__() takes exactly 2 arguments (0 given). Apply the existing exception-group constructor handling to the base class too.

The regression test covers global, instance and class registration, protocols 0 and the highest supported protocol, a nested ExceptionGroup, notes and tracebacks. Includes the changelog and AUTHORS entries requested by the contribution guidelines.

Evidence

  • Before: all six new regression cases fail with the constructor TypeError on Python 3.14.
    After: the complete tests and README examples pass: Python 3.14 70 passed; Python 3.11 70 passed; Python 3.9 62 passed, 8 skipped (exception groups require Python 3.11).
  • Validation: PYTHONNODEBUGRANGES=1 python -m pytest --benchmark-disable -q tests README.rst; tox -e py311,py39 -- pytest --benchmark-disable -q tests README.rst.
  • Source distribution build, Twine, manifest, Ruff lint/format and the whitespace/debug-statement hooks pass. Taplo formatting and a separate syntax-only check pass, but its default schema-catalog check fails to decode the external catalog response; the same failure occurs with unchanged upstream TOML files.
  • tox -e docs: HTML builds with the existing missing autoapi/index warning; linkcheck fails because the unchanged Coveralls badge URL returns HTTP 403. The full tox matrix is not claimed to pass.

Prepared with AI assistance and independently reviewed by another agent; no maintainer review is implied.

Merge Danger

Door: two-way. The change is a narrow, reversible correction to the existing reducer.

Blast Radius: serialization. It adds the existing group-argument handling to genuine BaseExceptionGroup instances while retaining ExceptionGroup behavior and the pre-3.11 guard.

Copilot AI balanced review requested due to automatic review settings November 15, 2026 22:08

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants