Repository navigation
Conversation
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.
Clear the compression reader's retained readResult during destruction and decref the allocated output bytes when reading new source input fails. Preserve the original exception.
Partially addresses #297: only compressionreader lifetime and read() output cleanup; read_to_iter and heap-type cleanup are outside this patch.
Regression coverage: Weak-reference checks for invalid source results and destruction with partially consumed input; eight 1 MiB read failures retain about 8 MiB on the C baseline. The post-fix test bounds retained allocations below one output buffer.
Validation on macOS 26.2 arm64 / CPython 3.12.14:
ZSTD_WARNINGS_AS_ERRORS=1 python setup.py build_ext --inplacebuilds the C and CFFI extensions.ZSTD_SLOW_TESTS=1 python -m pytest -q -n 4: 295 passed.PYTHON_ZSTANDARD_IMPORT_POLICY=cffi ZSTD_SLOW_TESTS=1 python -m pytest -q -n 4: 269 passed, 26 skipped.ruff check .,mypy tests/*.py zstandard/*.py, changed-fileruff format --check, andgit diff --checkpass.ruff format --check .reports only an existingsetup.pyindentation issue, reproduced on the untouched base.Both runs enabled
ZSTD_SLOW_TESTS=1with the default Hypothesis profile (100 examples), rather than the CI profile (1000 examples).The tracemalloc regression is restricted to CPython, so importing the test module does not introduce a tracemalloc dependency on PyPy.
Linux/Windows, other Python versions, PyPy, and the experimental Rust backend were not run locally.
AI disclosure: Code, tests, and this description were generated with OpenAI Codex and validated with automated local checks. This does not claim human review.