Set restype=None for void-returning C functions in conflict_set.py
CI / release (arm64, ubuntu-latest-arm64) (pull_request) Successful in 3m28s
CI / pre-commit (pull_request) Successful in 2m14s
CI / test (-DCMAKE_BUILD_TYPE=Debug, debug) (pull_request) Successful in 3m39s
CI / test (-DCMAKE_CXX_FLAGS=-DUSE_64_BIT=1, 64-bit-versions) (pull_request) Successful in 3m33s
CI / test (-DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++, gcc) (pull_request) Successful in 3m44s
CI / test (-DUSE_SIMD_FALLBACK=ON, simd-fallback) (pull_request) Successful in 3m32s
CI / release (amd64, ubuntu-latest-amd64) (pull_request) Failing after 4m25s
CI / coverage (pull_request) Failing after 3m20s

ConflictSet_check, ConflictSet_addWrites, ConflictSet_setOldestVersion,
and ConflictSet_destroy return void in C, but the Python wrapper left
their ctypes restype at the default c_int. Set restype = None for each
to match the C API contract and avoid undefined behavior from reading
the return register of void functions.
This commit is contained in:
2026-06-21 19:25:27 -04:00
committed by andrew
parent 6d8b939a81
commit 742d920aa1
+4
View File
@@ -88,6 +88,7 @@ class ConflictSet:
ctypes.POINTER(ctypes.c_int), ctypes.POINTER(ctypes.c_int),
ctypes.c_int, ctypes.c_int,
) )
self._lib.ConflictSet_check.restype = None
self._lib.ConflictSet_addWrites.argtypes = ( self._lib.ConflictSet_addWrites.argtypes = (
ctypes.c_void_p, ctypes.c_void_p,
@@ -95,13 +96,16 @@ class ConflictSet:
ctypes.c_int, ctypes.c_int,
ctypes.c_int64, ctypes.c_int64,
) )
self._lib.ConflictSet_addWrites.restype = None
self._lib.ConflictSet_setOldestVersion.argtypes = ( self._lib.ConflictSet_setOldestVersion.argtypes = (
ctypes.c_void_p, ctypes.c_void_p,
ctypes.c_int64, ctypes.c_int64,
) )
self._lib.ConflictSet_setOldestVersion.restype = None
self._lib.ConflictSet_destroy.argtypes = (ctypes.c_void_p,) self._lib.ConflictSet_destroy.argtypes = (ctypes.c_void_p,)
self._lib.ConflictSet_destroy.restype = None
self._lib.ConflictSet_getBytes.argtypes = (ctypes.c_void_p,) self._lib.ConflictSet_getBytes.argtypes = (ctypes.c_void_p,)
self._lib.ConflictSet_getBytes.restype = ctypes.c_int64 self._lib.ConflictSet_getBytes.restype = ctypes.c_int64