Closed mgedmin closed 7 years ago
_pickle_27.c has a static int stackUnderflow()
. _pickle_32.c has a static int stack_underflow()
. Looks like the C implementation of noload
calls the wrong one:
diff --git a/src/zodbpickle/_pickle_32.c b/src/zodbpickle/_pickle_32.c
index 2e559da..a5076bc 100644
--- a/src/zodbpickle/_pickle_32.c
+++ b/src/zodbpickle/_pickle_32.c
@@ -5615,7 +5615,7 @@ do_noload_setitems(UnpicklerObject *self, Py_ssize_t x)
Py_ssize_t len;
if (!( (len=Py_SIZE(self->stack)) >= x
- && x > 0 )) return stackUnderflow();
+ && x > 0 )) return stack_underflow();
dict=self->stack->data[x-1];
if (dict == Py_None) {
What's more worrying is that no tests fail when the C module cannot be built. This is why I'm not committing my fix yet.
BTW on Linux the undefined name doesn't cause a compile-time error, it causes an import-time error:
$ tox -e py32
...
building 'zodbpickle._pickle' extension
gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python3.2mu -c src/zodbpickle/_pickle_32.c -o build/temp.linux-x86_64-3.2/src/zodbpickle/_pickle_32.o
src/zodbpickle/_pickle_32.c: In function ‘do_noload_setitems’:
src/zodbpickle/_pickle_32.c:5618:12: warning: implicit declaration of function ‘stackUnderflow’ [-Wimplicit-function-declaration]
&& x > 0 )) return stackUnderflow();
^
gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro build/temp.linux-x86_64-3.2/src/zodbpickle/_pickle_32.o -o build/lib.linux-x86_64-3.2/zodbpickle/_pickle.cpython-32mu.so
copying build/lib.linux-x86_64-3.2/zodbpickle/_pickle.cpython-32mu.so -> src/zodbpickle
.............s.........s..............sss......s..........................................
----------------------------------------------------------------------
Ran 90 tests in 0.335s
OK (skipped=6)
$ .tox/py32/bin/python
...
>>> from zodbpickle import _pickle
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: /home/mg/src/zopefoundation/zodbpickle/.tox/py32/lib/python3.2/site-packages/zodbpickle/_pickle.cpython-32mu.so: undefined symbol: stackUnderflow
Somebody ought to check whether this issue affects Python 3.3 and newer.
AFAICS this was only affecting Python 3.2, which we're no longer supporting, so closing this bug.
Here's an excerpt from the build log: