Repository navigation
Conversation
NumPy 2.5 allocates with PyMem_RawMalloc, but frees OWNDATA arrays that
have no memory handler with libc free(). The two differ on free-threaded
3.15 (mimalloc) and under PYTHONMALLOC=debug, so matrix.serialize and
binread aborted there.
- claim_buffer attaches NumPy's default memory handler (setup.py sets
NPY_TARGET_VERSION to 1.22 to expose it)
- binread allocates with GraphBLAS's own allocator instead of libc malloc
- add utils.can_unclaim_buffer to check before handing an array's buffer
to GraphBLAS; document unclaim_buffer
- initialize() raises if GraphBLAS fails to initialize
- add tests/test_memory.py (runs in a subprocess with PYTHONMALLOC=debug)
Python 3.15 and maintenance:
- add 3.15 classifier and Black target; test 3.15 rc in CI via the
conda-forge python_rc channel, ranked below conda-forge
- cibuildwheel v3.4 -> v4.2 (builds cp315 and cp315t wheels)
- update all actions and pin them to commit SHAs; group Dependabot
updates with a 7-day cooldown
- least-privilege workflow permissions, cancel superseded PR runs, no
${{ }} expansion inside run: scripts; `bash -el` so a failing command
in a multi-command test step fails the step
- stricter pytest config: warnings are errors, strict markers and config
- update pre-commit hooks; add actionlint, zizmor and pysentry
- rename CLAUDE.md to AGENTS.md and update it
- publish via PyPI Trusted Publishing (environments pypi and test-pypi)
instead of an API token
GraphBLAS (>= 10.4) frees a buffer with its arena's allocator, and NumPy frees an array's data with the array's memory handler. A buffer that crosses between them needs both to agree, or the wrong free aborts (free-threaded 3.15, PYTHONMALLOC=debug) or corrupts memory. - claim_buffer and claim_buffer_2d attach the handler for the buffer's arena (NumPy's default if the arena uses NumPy's allocator, else one that calls the arena's functions); new optional `arena` argument - add give_buffer, a context manager that hands an array (or a copy) to GraphBLAS and commits only if GraphBLAS took it, and empty(), which allocates arrays GraphBLAS can always own - can_unclaim_buffer checks the handler matches the arena; unclaim_buffer raises if the array can't be owned - serialize_* name the result's arena; binread reads into the new matrix's arena and packs with give_buffer, which also fixes iso matrices packed with a full-size Ax_size; binwrite restores the matrix if writing fails - tests fail when NumPy frees an array that has no handler; test_memory covers both memory managers and a libc arena (explicit, global, and Context); doctests run for every api module; wheel tests use -W error - drop stale flake8 ignores; ignore create_headers.py's output
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.
No description provided.