Set restype=None for void-returning C functions in conflict_set.py
CI / build-image (arm64, ubuntu-latest-arm64) (pull_request) Failing after 21s
CI / build-image (amd64, ubuntu-latest-amd64) (pull_request) Failing after 41s
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 / release (arm64, ubuntu-latest-arm64) (pull_request) Has been skipped
CI / coverage (pull_request) Has been skipped
CI / build-image (arm64, ubuntu-latest-arm64) (pull_request) Failing after 21s
CI / build-image (amd64, ubuntu-latest-amd64) (pull_request) Failing after 41s
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 / release (arm64, ubuntu-latest-arm64) (pull_request) Has been skipped
CI / coverage (pull_request) Has been skipped
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:
@@ -88,6 +88,7 @@ class ConflictSet:
|
||||
ctypes.POINTER(ctypes.c_int),
|
||||
ctypes.c_int,
|
||||
)
|
||||
self._lib.ConflictSet_check.restype = None
|
||||
|
||||
self._lib.ConflictSet_addWrites.argtypes = (
|
||||
ctypes.c_void_p,
|
||||
@@ -95,13 +96,16 @@ class ConflictSet:
|
||||
ctypes.c_int,
|
||||
ctypes.c_int64,
|
||||
)
|
||||
self._lib.ConflictSet_addWrites.restype = None
|
||||
|
||||
self._lib.ConflictSet_setOldestVersion.argtypes = (
|
||||
ctypes.c_void_p,
|
||||
ctypes.c_int64,
|
||||
)
|
||||
self._lib.ConflictSet_setOldestVersion.restype = None
|
||||
|
||||
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.restype = ctypes.c_int64
|
||||
|
||||
Reference in New Issue
Block a user