Skip to content

fix: preserve container subclass snapshots and cyclic references - #61

Merged
cocolato merged 2 commits into
mainfrom
fix/container-snapshots
Oct 18, 2026
Merged

cocolato merged 2 commits into
mainfrom
fix/container-snapshots

Conversation

@cocolato

@cocolato cocolato commented Oct 18, 2026 •

Copy link
Copy Markdown
Owner

Bounded snapshots currently turn common container subclasses into placeholders that lose their entries and fields. Capture dict/list/tuple/set/frozenset subclasses with builtin-compatible adapters that retain entries, original type names, instance attributes, slots, named fields, and shared references. Python 3.15 frozendict values use portable mapping copies.

Keep item/node selection bounded and avoid application hooks when reading types, entries, and attributes. OrderedDict retains link order for safe keys; custom-key order falls back to insertion order with a visible mapping_order omission. Preserve mutable cycles during pickle/dill state restoration, immutable-key lookup behavior, multiline pretty-printing, and snapshot metadata during recapture. Add targeted regressions and document the captured representation.

Refs #58. Third PR in the series. PRs #59 and #60 are merged, and this PR now targets main; the diff contains the container changes.

Validation:

  • CPython 3.13.15 full suite: 151 passed, 2 skipped; coverage 89.64% (85% gate).
  • CPython 3.15.0 full suite: 152 passed, including frozendict; the single failure was the existing native PID integration test because macOS denied access to the child process task port. Running that exact test on the unchanged base commit reproduced the same permission error.
  • Ruff lint/format checks, git diff --check, and strict Sphinx build passed.
  • The three commits together were compared byte-for-byte with all 14 reviewed tracked files; local historical review notes are excluded.

Native PID attachment on this local macOS/Python 3.15 interpreter remains blocked by OS permissions; this does not affect the passing CI matrix below.

CI on the latest head: all 10 checks passed, covering Linux Python 3.11–3.15, Windows/macOS Python 3.14, quality, documentation, and distributions. Workflow run.

@cocolato
cocolato changed the base branch from fix/snapshot-metadata to main October 18, 2026 16:02
@cocolato
cocolato merged commit e960526 into main Oct 18, 2026
10 checks passed
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.

1 participant