explosion / srsly

🦉 Modern high-performance serialization utilities for Python (JSON, MessagePack, Pickle)
MIT License
435 stars 31 forks source link

Duplicate uint64_t ctypedef when building with Cython 3.0.8 and Python 3.12 #107

Closed ptrcnull closed 7 months ago

ptrcnull commented 7 months ago
Error compiling Cython file:
------------------------------------------------------------
...
    object PyMemoryView_GetContiguous(object obj, int buffertype, char order)

from libc.stdlib cimport *
from libc.string cimport *
from libc.limits cimport *
ctypedef unsigned long long uint64_t
^
------------------------------------------------------------

srsly/msgpack/_unpacker.pyx:13:0: 'uint64_t' redeclared 

Error compiling Cython file:
------------------------------------------------------------
...
cdef extern from "Python.h":
    ctypedef int int32_t
    ctypedef int int64_t
    ctypedef unsigned int uint32_t
    ctypedef unsigned int uint64_t
    ^
------------------------------------------------------------

/usr/lib/python3.12/site-packages/Cython/Includes/cpython/pyport.pxd:5:4: Previous declaration is here
ncopa commented 7 months ago

This makes it build:

diff --git a/srsly/msgpack/_unpacker.pyx b/srsly/msgpack/_unpacker.pyx
index b6c5f04..17a0059 100644
--- a/srsly/msgpack/_unpacker.pyx
+++ b/srsly/msgpack/_unpacker.pyx
@@ -10,7 +10,6 @@ cdef extern from "Python.h":
 from libc.stdlib cimport *
 from libc.string cimport *
 from libc.limits cimport *
-ctypedef unsigned long long uint64_t

 from .exceptions import (
     BufferFull,
svlandeg commented 7 months ago

Thanks for the report! We're looking into this. I think we can just avoid the redefinition all together - cf #108