Closed icemac closed 6 months ago
@davisagli Could you please have a look at the new build failures as we are now running on Python 3.13a4+?
@icemac It looks like the _PyLong_AsByteArray function signature was modified, and there is some ongoing discussion about a public API to replace it in https://github.com/python/cpython/issues/111140
I'll try to take a closer look in the next week at whether we can do something simple to work around it.
I can reproduce the _PyLong_AsByteArray
error locally with Python 3.13.0a5. I'll try to look at this one this week.
The error against 3.13.0a5 looks like so:
$ gcc -pthread -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O3 -Wall -fPIC -I.tox/.pkg-cpython313/include -I/opt/Python-3.13.0a5/include/python3.13 -c src/zodbpickle/_pickle_33.c -o /tmp/_pickle_33.o
src/zodbpickle/_pickle_33.c: In function ‘save_long’:
src/zodbpickle/_pickle_33.c:1668:13: error: too few arguments to function ‘_PyLong_AsByteArray’
1668 | i = _PyLong_AsByteArray((PyLongObject *)obj,
| ^~~~~~~~~~~~~~~~~~~
In file included from /opt/Python-3.13.0a5/include/python3.13/longobject.h:90,
from /opt/Python-3.13.0a5/include/python3.13/Python.h:66,
from src/zodbpickle/_pickle_33.c:1:
/opt/Python-3.13.0a5/include/python3.13/cpython/longobject.h:85:17: note: declared here
85 | PyAPI_FUNC(int) _PyLong_AsByteArray(PyLongObject* v,
| ^~~~~~~~~~~~~~~~~~~
src/zodbpickle/_pickle_33.c: In function ‘save_float’:
src/zodbpickle/_pickle_33.c:1740:30: warning: pointer targets in passing argument 2 of ‘PyFloat_Pack8’ differ in signedness [-Wpointer-sign]
1740 | if (PyFloat_Pack8(x, (unsigned char *)&pdata[1], 0) < 0)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
| |
| unsigned char *
In file included from /opt/Python-3.13.0a5/include/python3.13/floatobject.h:47,
from /opt/Python-3.13.0a5/include/python3.13/Python.h:69,
from src/zodbpickle/_pickle_33.c:1:
/opt/Python-3.13.0a5/include/python3.13/cpython/floatobject.h:23:47: note: expected ‘char *’ but argument is of type ‘unsigned char *’
23 | PyAPI_FUNC(int) PyFloat_Pack8(double x, char *p, int le);
| ~~~~~~^
src/zodbpickle/_pickle_33.c: In function ‘load_binfloat’:
src/zodbpickle/_pickle_33.c:4292:25: warning: pointer targets in passing argument 1 of ‘PyFloat_Unpack8’ differ in signedness [-Wpointer-sign]
4292 | x = PyFloat_Unpack8((unsigned char *)s, 0);
| ^~~~~~~~~~~~~~~~~~
| |
| unsigned char *
In file included from /opt/Python-3.13.0a5/include/python3.13/floatobject.h:47,
from /opt/Python-3.13.0a5/include/python3.13/Python.h:69,
from src/zodbpickle/_pickle_33.c:1:
/opt/Python-3.13.0a5/include/python3.13/cpython/floatobject.h:27:48: note: expected ‘const char *’ but argument is of type ‘unsigned char *’
27 | PyAPI_FUNC(double) PyFloat_Unpack8(const char *p, int le);
A quick spelunk through the versions of Python's _pickle.c
I have on my system:
$ for pyver in $(ls -d /opt/src/Python-3* | cut -d "-" -f 2 | cut -d "." -f 2,3 | sort -g); do
> mod="/opt/src/Python-3.$pyver/Modules/_pickle.c"
> echo "---------------------------------------------"
> echo $mod
> echo "---------------------------------------------"
> grep -A3 _PyLong_AsByteArray $mod
> done
---------------------------------------------
/opt/src/Python-3.5.9/Modules/_pickle.c
---------------------------------------------
i = _PyLong_AsByteArray((PyLongObject *)obj,
pdata, nbytes,
1 /* little endian */ , 1 /* signed */ );
if (i < 0)
---------------------------------------------
/opt/src/Python-3.6.15/Modules/_pickle.c
---------------------------------------------
i = _PyLong_AsByteArray((PyLongObject *)obj,
pdata, nbytes,
1 /* little endian */ , 1 /* signed */ );
if (i < 0)
---------------------------------------------
/opt/src/Python-3.7.12/Modules/_pickle.c
---------------------------------------------
i = _PyLong_AsByteArray((PyLongObject *)obj,
pdata, nbytes,
1 /* little endian */ , 1 /* signed */ );
if (i < 0)
---------------------------------------------
/opt/src/Python-3.8.12/Modules/_pickle.c
---------------------------------------------
i = _PyLong_AsByteArray((PyLongObject *)obj,
pdata, nbytes,
1 /* little endian */ , 1 /* signed */ );
if (i < 0)
---------------------------------------------
/opt/src/Python-3.8.19/Modules/_pickle.c
---------------------------------------------
i = _PyLong_AsByteArray((PyLongObject *)obj,
pdata, nbytes,
1 /* little endian */ , 1 /* signed */ );
if (i < 0)
---------------------------------------------
/opt/src/Python-3.9.19/Modules/_pickle.c
---------------------------------------------
i = _PyLong_AsByteArray((PyLongObject *)obj,
pdata, nbytes,
1 /* little endian */ , 1 /* signed */ );
if (i < 0)
---------------------------------------------
/opt/src/Python-3.9.7/Modules/_pickle.c
---------------------------------------------
i = _PyLong_AsByteArray((PyLongObject *)obj,
pdata, nbytes,
1 /* little endian */ , 1 /* signed */ );
if (i < 0)
---------------------------------------------
/opt/src/Python-3.10.0/Modules/_pickle.c
---------------------------------------------
i = _PyLong_AsByteArray((PyLongObject *)obj,
pdata, nbytes,
1 /* little endian */ , 1 /* signed */ );
if (i < 0)
---------------------------------------------
/opt/src/Python-3.10.14/Modules/_pickle.c
---------------------------------------------
i = _PyLong_AsByteArray((PyLongObject *)obj,
pdata, nbytes,
1 /* little endian */ , 1 /* signed */ );
if (i < 0)
---------------------------------------------
/opt/src/Python-3.11.1/Modules/_pickle.c
---------------------------------------------
i = _PyLong_AsByteArray((PyLongObject *)obj,
pdata, nbytes,
1 /* little endian */ , 1 /* signed */ );
if (i < 0)
---------------------------------------------
/opt/src/Python-3.11.7/Modules/_pickle.c
---------------------------------------------
i = _PyLong_AsByteArray((PyLongObject *)obj,
pdata, nbytes,
1 /* little endian */ , 1 /* signed */ );
if (i < 0)
---------------------------------------------
/opt/src/Python-3.11.8/Modules/_pickle.c
---------------------------------------------
i = _PyLong_AsByteArray((PyLongObject *)obj,
pdata, nbytes,
1 /* little endian */ , 1 /* signed */ );
if (i < 0)
---------------------------------------------
/opt/src/Python-3.12.0/Modules/_pickle.c
---------------------------------------------
i = _PyLong_AsByteArray((PyLongObject *)obj,
pdata, nbytes,
1 /* little endian */ , 1 /* signed */ );
if (i < 0)
---------------------------------------------
/opt/src/Python-3.12.1/Modules/_pickle.c
---------------------------------------------
i = _PyLong_AsByteArray((PyLongObject *)obj,
pdata, nbytes,
1 /* little endian */ , 1 /* signed */ );
if (i < 0)
---------------------------------------------
/opt/src/Python-3.12.2/Modules/_pickle.c
---------------------------------------------
i = _PyLong_AsByteArray((PyLongObject *)obj,
pdata, nbytes,
1 /* little endian */ , 1 /* signed */ );
if (i < 0)
---------------------------------------------
/opt/src/Python-3.13.0a5/Modules/_pickle.c
---------------------------------------------
#include "pycore_long.h" // _PyLong_AsByteArray()
#include "pycore_moduleobject.h" // _PyModule_GetState()
#include "pycore_object.h" // _PyNone_Type
#include "pycore_pystate.h" // _PyThreadState_GET()
--
i = _PyLong_AsByteArray((PyLongObject *)obj,
pdata, nbytes,
1 /* little endian */ , 1 /* signed */ ,
1 /* with exceptions */);
Again we get errors while compiling the C code: