Repository navigation
Manage native stream ownership and lifecycle - #266
Closed
sricharanreddycheruku wants to merge 1 commit into
Closed
sricharanreddycheruku wants to merge 1 commit into
sricharanreddycheruku wants to merge 1 commit into
Conversation
Retain constructor objects, balance factory and context-manager references, collect cycles, and make native closure explicit and idempotent. Validate closed-stream operations and preserve end-of-data callback failures.
This was referenced Oct 7, 2026
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.
Fix native stream object ownership and closure: retain constructor objects,
balance factory/context references, collect cycles and free unclosed native
state. Make close idempotent, reject closed scans or replacing open streams,
preserve end-of-data callback failures and fix Scratch argument parsing.
Document the behavior.
21 new lifecycle cases: 18 fail on original source, three compatibility controls
pass; all pass after the fix. Source-built Python 3.12 suite: 53 pass/two slow
skips. Python 3.10/3.14: 52 pass/three skips (including an existing UTF-8 compiler
limitation), all lifecycle cases pass with PYTHONMALLOC=debug. Combined with
#265: 87 pass/two skips under the debug allocator. clang-format 9, Black, Ruff,
strict docs and diff checks pass. Python 3.9 has an unchanged Py_NewRef build
failure; it was not validated. Independent branch from main.