Repository navigation
Release compile metadata references and propagate ID lookup errors - #265
Open
sricharanreddycheruku wants to merge 2 commits into
Open
sricharanreddycheruku wants to merge 2 commits into
sricharanreddycheruku wants to merge 2 commits into
Conversation
This was referenced Oct 7, 2026
This branch has not been 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.
Compiling multiple expressions leaks references to earlier ID and flag items because the loop overwrites each owned reference before releasing it. An ID sequence that raises during item lookup also passes NULL into integer conversion instead of propagating the exception.
Release ID and flag references after each successful iteration and at the error boundary, and check failed ID lookup before conversion. Keep the existing 34 regression and compatibility cases for metadata cleanup, sequence errors, and expression retention.
Main now contains the expression-ownership implementation from #275. This revision merges current main, preserves that implementation and its UTF-8 handling, and limits the remaining C change to metadata cleanup and ID lookup errors. The existing source branch is unchanged.
Validation on Linux with CPython 3.14.8, using a wheel built from this source with bundled Vectorscan 5.4.12:
python -m pytest tests/ -vvv: 66 passed, 2 skipped. The two default slow-test skips each require approximately 4 GiB and are enabled with--run-slow.PYTHONMALLOC=debug python -m pytest tests/test_compile_lifetimes.py -vvv: all 34 passed.mkdocs build --strictpassed.Against a source-built unchanged-main extension, the ID lookup regression fails with SystemError instead of the original exception, and both metadata reference-count regressions fail. Restoring the patched wheel passes all 34 cases again. git diff --check passes. Tested source is committed at 3bfcabc. Other interpreters, platforms, the slow tests, and the upstream wheel matrix have not been rerun for this revision.