Repository navigation
snapshot(fix): Reject attribute deletion - #207
Merged
Merged
Conversation
why: Snapshot guarded attribute assignment via __setattr__ without a matching __delattr__, letting callers delete slotted fields like cursor or _frozen from a cached Terminal.committed frame and corrupting reads for subsequent consumers. what: - Add Snapshot.__delattr__ and type __setattr__/__delattr__ as NoReturn - Initialize Snapshot slots via object.__setattr__ and drop _frozen - Add regression tests for cached, ?2026-held, and sibling views - Record the fix in CHANGES under 0.0.1a7 Fixes #198
This branch was successfully deployed
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
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.
Fixes #198
Summary
Snapshotinsrc/libvt/snapshot.pywith siblingSyncToken: removes the_frozenslot bypass, initializes all 22 slots viaobject.__setattr__in_make_snapshot, and defines both__setattr__ -> t.NoReturnand__delattr__ -> t.NoReturnraisingAttributeError.del frame.cursor(or any other slot/attribute deletion) from corrupting cachedTerminal.committed/Terminal.snapshot()frames returned to subsequent callers, and surfaces invalid assignment/deletion statically inty.tests/test_terminal.py(literal serialized frames, allSnapshot.__slots__+ properties,?2026held/committed & CoW isolation,Screen.snapshot(),SyncToken,ScreenDelta) andtests/test_screen.py(ephemeral view immutability +copy/pickle), plus aCHANGESentry under0.0.1a7.Verification
ty(3.12–3.15 +win323.12, valid calls +invalid-assignmentmisuse),pytest(1237 passed, 2 skippedincluding doctests), Sphinxdirhtml -W(0 warnings).adopt as is(Gates 1–4 PASS, new code 9.7/10, all applicable items 9.5–9.8/10).