Commit Graph
1 Commits
Author SHA1 Message Date
weaselbot 045bf9b5ef Keep Python key buffers alive in WriteRange/ReadRange
CI / build-image (arm64, ubuntu-latest-arm64) (pull_request) Failing after 20s
CI / release (arm64, ubuntu-latest-arm64) (pull_request) Has been skipped
CI / build-image (amd64, ubuntu-latest-amd64) (pull_request) Failing after 37s
CI / pre-commit (pull_request) Has been skipped
CI / test (-DCMAKE_BUILD_TYPE=Debug, debug) (pull_request) Has been skipped
CI / test (-DCMAKE_CXX_FLAGS=-DUSE_64_BIT=1, 64-bit-versions) (pull_request) Has been skipped
CI / test (-DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++, gcc) (pull_request) Has been skipped
CI / test (-DUSE_SIMD_FALLBACK=ON, simd-fallback) (pull_request) Has been skipped
CI / release (amd64, ubuntu-latest-amd64) (pull_request) Has been skipped
CI / coverage (pull_request) Has been skipped
`write()` and `read()` created _Key objects from ephemeral ctypes arrays
backed by local bytearray objects. Once the helpers returned, those local
variables were freed, leaving the C library with dangling pointers when
addWrites()/check() later read the keys.

Store the backing bytearray on the returned WriteRange/ReadRange objects
as private `_begin_buf` / `_end_buf` attributes. Python keeps them alive
for the lifetime of the range object, so the C pointer is always valid.

Closes #42
2026-06-18 22:21:56 -04:00