oconnor663 / blake3-py

Python bindings for the BLAKE3 cryptographic hash function
Other
148 stars 14 forks source link

C implementation fails to compile with GCC 14 #43

Closed mgorny closed 5 months ago

mgorny commented 5 months ago

When building with GCC 14 (that's more strict than previous versions), the package fails to build:

$ python3.12 setup.py build
including x86-64 Unix assembly
running build
running build_ext
building 'blake3' extension
creating build/temp.linux-x86_64-cpython-312
creating build/temp.linux-x86_64-cpython-312/vendor
x86_64-pc-linux-gnu-gcc -fno-strict-overflow -Wsign-compare -fPIC -DSETUP_PY_VERSION=\"0.0.1\" "-DSETUP_PY_DESCRIPTION=\"experimental bindings for the BLAKE3 C implementation, API-compatible with the Rust-based blake3 module\"" -Ivendor -I/usr/include/python3.12 -c blake3module.c -o build/temp.linux-x86_64-cpython-312/blake3module.o
blake3module.c: In function ‘Blake3_update’:
blake3module.c:220:7: error: assignment to ‘PyObject *’ {aka ‘struct _object *’} from incompatible pointer type ‘Blake3Object *’ [-Wincompatible-pointer-types]
  220 |   ret = self;
      |       ^
blake3module.c: In function ‘Blake3_update_mmap’:
blake3module.c:275:7: error: assignment to ‘PyObject *’ {aka ‘struct _object *’} from incompatible pointer type ‘Blake3Object *’ [-Wincompatible-pointer-types]
  275 |   ret = self;
      |       ^
blake3module.c: At top level:
blake3module.c:350:21: error: initialization of ‘PyObject * (*)(PyObject *, PyObject *)’ {aka ‘struct _object * (*)(struct _object *, struct _object *)’} from incompatible pointer type ‘PyObject * (*)(PyObject *, PyObject *, PyObject *)’ {aka ‘struct _object * (*)(struct _object *, struct _object *, struct _object *)’} [-Wincompatible-pointer-types]
  350 |     {"update_mmap", (PyCFunctionWithKeywords)Blake3_update_mmap,
      |                     ^
blake3module.c:350:21: note: (near initialization for ‘Blake3_methods[1].ml_meth’)
blake3module.c:352:16: error: initialization of ‘PyObject * (*)(PyObject *, PyObject *)’ {aka ‘struct _object * (*)(struct _object *, struct _object *)’} from incompatible pointer type ‘PyObject * (*)(PyObject *, PyObject *, PyObject *)’ {aka ‘struct _object * (*)(struct _object *, struct _object *, struct _object *)’} [-Wincompatible-pointer-types]
  352 |     {"digest", (PyCFunctionWithKeywords)Blake3_digest,
      |                ^
blake3module.c:352:16: note: (near initialization for ‘Blake3_methods[2].ml_meth’)
blake3module.c:354:19: error: initialization of ‘PyObject * (*)(PyObject *, PyObject *)’ {aka ‘struct _object * (*)(struct _object *, struct _object *)’} from incompatible pointer type ‘PyObject * (*)(PyObject *, PyObject *, PyObject *)’ {aka ‘struct _object * (*)(struct _object *, struct _object *, struct _object *)’} [-Wincompatible-pointer-types]
  354 |     {"hexdigest", (PyCFunctionWithKeywords)Blake3_hexdigest,
      |                   ^
blake3module.c:354:19: note: (near initialization for ‘Blake3_methods[3].ml_meth’)
error: command '/usr/bin/x86_64-pc-linux-gnu-gcc' failed with exit code 1

Reproduced with Python 3.12.4, blake3-py 40c8bd98c2d05611604734a1e05dabd7a2739f21.