zopefoundation / zope.interface

Interfaces for Python
http://zopeinterface.readthedocs.io/
Other
330 stars 71 forks source link

7.0.2 on Python 3.11+: `python: Objects/typeobject.c:3388: PyType_FromModuleAndSpec: Assertion 'memb->type == T_PYSSIZET' failed.` #319

Closed mgorny closed 2 months ago

mgorny commented 2 months ago

BUG/PROBLEM REPORT / FEATURE REQUEST

What I did:

  1. Build Python 3.11 --with-assertions.
  2. tox -e py311

What I expect to happen:

Tests passing.

What actually happened:

Python crashes immediately:

py311: commands[0]> coverage run -p -m unittest discover -s src
python: Objects/typeobject.c:3388: PyType_FromModuleAndSpec: Assertion `memb->type == T_PYSSIZET' failed.
(gdb) bt
#0  0x00007fa8f349639c in ?? () from /usr/lib64/libc.so.6
#1  0x00007fa8f343ec96 in raise () from /usr/lib64/libc.so.6
#2  0x00007fa8f34268fa in abort () from /usr/lib64/libc.so.6
#3  0x00007fa8f342681e in ?? () from /usr/lib64/libc.so.6
#4  0x00007fa8f3436fd6 in __assert_fail () from /usr/lib64/libc.so.6
#5  0x00007fa8f371dc34 in ?? () from /usr/lib64/libpython3.11.so.1.0
#6  0x00007fa8f32e8cc5 in _zic_module_exec (module=<module at remote 0x7fa8f2320c20>)
    at src/zope/interface/_zope_interface_coptimizations.c:2571
#7  0x00007fa8f3867cd3 in PyModule_ExecDef () from /usr/lib64/libpython3.11.so.1.0
#8  0x00007fa8f386d450 in ?? () from /usr/lib64/libpython3.11.so.1.0
#9  0x00007fa8f37e85e1 in ?? () from /usr/lib64/libpython3.11.so.1.0
#10 0x00007fa8f37d9aad in _PyEval_EvalFrameDefault () from /usr/lib64/libpython3.11.so.1.0
#11 0x00007fa8f37ce43f in ?? () from /usr/lib64/libpython3.11.so.1.0
#12 0x00007fa8f37e8d10 in ?? () from /usr/lib64/libpython3.11.so.1.0
#13 0x00007fa8f3813d4b in PyObject_CallMethodObjArgs () from /usr/lib64/libpython3.11.so.1.0
#14 0x00007fa8f3813415 in PyImport_ImportModuleLevelObject () from /usr/lib64/libpython3.11.so.1.0
#15 0x00007fa8f381ff7e in ?? () from /usr/lib64/libpython3.11.so.1.0
#16 0x00007fa8f37e0b47 in ?? () from /usr/lib64/libpython3.11.so.1.0
#17 0x00007fa8f37d9aad in _PyEval_EvalFrameDefault () from /usr/lib64/libpython3.11.so.1.0
#18 0x00007fa8f37ce43f in ?? () from /usr/lib64/libpython3.11.so.1.0
#19 0x00007fa8f37e8d10 in ?? () from /usr/lib64/libpython3.11.so.1.0
#20 0x00007fa8f3813d4b in PyObject_CallMethodObjArgs () from /usr/lib64/libpython3.11.so.1.0
#21 0x00007fa8f38134a4 in PyImport_ImportModuleLevelObject () from /usr/lib64/libpython3.11.so.1.0
#22 0x00007fa8f37da9d0 in _PyEval_EvalFrameDefault () from /usr/lib64/libpython3.11.so.1.0
#23 0x00007fa8f37cf760 in ?? () from /usr/lib64/libpython3.11.so.1.0
#24 0x00007fa8f386275b in PyEval_EvalCode () from /usr/lib64/libpython3.11.so.1.0
#25 0x00007fa8f3879182 in ?? () from /usr/lib64/libpython3.11.so.1.0
#26 0x00007fa8f37e0b47 in ?? () from /usr/lib64/libpython3.11.so.1.0
#27 0x00007fa8f37d9aad in _PyEval_EvalFrameDefault () from /usr/lib64/libpython3.11.so.1.0
#28 0x00007fa8f37ce43f in ?? () from /usr/lib64/libpython3.11.so.1.0
#29 0x00007fa8f37e8d10 in ?? () from /usr/lib64/libpython3.11.so.1.0
#30 0x00007fa8f3813d4b in PyObject_CallMethodObjArgs () from /usr/lib64/libpython3.11.so.1.0
#31 0x00007fa8f3813415 in PyImport_ImportModuleLevelObject () from /usr/lib64/libpython3.11.so.1.0
#32 0x00007fa8f37da9d0 in _PyEval_EvalFrameDefault () from /usr/lib64/libpython3.11.so.1.0
#33 0x00007fa8f37cf760 in ?? () from /usr/lib64/libpython3.11.so.1.0
#34 0x00007fa8f386275b in PyEval_EvalCode () from /usr/lib64/libpython3.11.so.1.0
#35 0x00007fa8f3879182 in ?? () from /usr/lib64/libpython3.11.so.1.0
#36 0x00007fa8f37e0b47 in ?? () from /usr/lib64/libpython3.11.so.1.0
#37 0x00007fa8f37d9aad in _PyEval_EvalFrameDefault () from /usr/lib64/libpython3.11.so.1.0
#38 0x00007fa8f37ce43f in ?? () from /usr/lib64/libpython3.11.so.1.0
#39 0x00007fa8f37e8d10 in ?? () from /usr/lib64/libpython3.11.so.1.0
#40 0x00007fa8f3813d4b in PyObject_CallMethodObjArgs () from /usr/lib64/libpython3.11.so.1.0
#41 0x00007fa8f3813415 in PyImport_ImportModuleLevelObject () from /usr/lib64/libpython3.11.so.1.0
#42 0x00007fa8f381ff7e in ?? () from /usr/lib64/libpython3.11.so.1.0
#43 0x00007fa8f37e0b47 in ?? () from /usr/lib64/libpython3.11.so.1.0
#44 0x00007fa8f37e073c in PyObject_Vectorcall () from /usr/lib64/libpython3.11.so.1.0
#45 0x00007fa8f37d514c in _PyEval_EvalFrameDefault () from /usr/lib64/libpython3.11.so.1.0
#46 0x00007fa8f3813864 in ?? () from /usr/lib64/libpython3.11.so.1.0
#47 0x00007fa8f3842d95 in PyIter_Send () from /usr/lib64/libpython3.11.so.1.0
#48 0x00007fa8f37d95e2 in _PyEval_EvalFrameDefault () from /usr/lib64/libpython3.11.so.1.0
#49 0x00007fa8f3813864 in ?? () from /usr/lib64/libpython3.11.so.1.0
#50 0x00007fa8f3812cc1 in ?? () from /usr/lib64/libpython3.11.so.1.0
#51 0x00007fa8f38123ed in ?? () from /usr/lib64/libpython3.11.so.1.0
#52 0x00007fa8f3834ab6 in ?? () from /usr/lib64/libpython3.11.so.1.0
#53 0x00007fa8f3834816 in ?? () from /usr/lib64/libpython3.11.so.1.0
#54 0x00007fa8f37e073c in PyObject_Vectorcall () from /usr/lib64/libpython3.11.so.1.0
#55 0x00007fa8f37d514c in _PyEval_EvalFrameDefault () from /usr/lib64/libpython3.11.so.1.0
#56 0x00007fa8f37ce43f in ?? () from /usr/lib64/libpython3.11.so.1.0
#57 0x00007fa8f37cbbef in _PyObject_FastCallDictTstate () from /usr/lib64/libpython3.11.so.1.0
#58 0x00007fa8f37fbcfb in _PyObject_Call_Prepend () from /usr/lib64/libpython3.11.so.1.0
#59 0x00007fa8f37fbb79 in ?? () from /usr/lib64/libpython3.11.so.1.0
#60 0x00007fa8f37c7164 in ?? () from /usr/lib64/libpython3.11.so.1.0
#61 0x00007fa8f37c6f34 in _PyObject_MakeTpCall () from /usr/lib64/libpython3.11.so.1.0
#62 0x00007fa8f37d514c in _PyEval_EvalFrameDefault () from /usr/lib64/libpython3.11.so.1.0
#63 0x00007fa8f37cf760 in ?? () from /usr/lib64/libpython3.11.so.1.0
#64 0x00007fa8f386275b in PyEval_EvalCode () from /usr/lib64/libpython3.11.so.1.0
#65 0x00007fa8f3879182 in ?? () from /usr/lib64/libpython3.11.so.1.0
#66 0x00007fa8f37e0b47 in ?? () from /usr/lib64/libpython3.11.so.1.0
#67 0x00007fa8f37e073c in PyObject_Vectorcall () from /usr/lib64/libpython3.11.so.1.0
#68 0x00007fa8f37d514c in _PyEval_EvalFrameDefault () from /usr/lib64/libpython3.11.so.1.0
#69 0x00007fa8f37ce43f in ?? () from /usr/lib64/libpython3.11.so.1.0
--Type <RET> for more, q to quit, c to continue without paging--c
#70 0x00007fa8f388b095 in ?? () from /usr/lib64/libpython3.11.so.1.0
#71 0x00007fa8f388a90a in Py_RunMain () from /usr/lib64/libpython3.11.so.1.0
#72 0x00007fa8f3854beb in Py_BytesMain () from /usr/lib64/libpython3.11.so.1.0
#73 0x00007fa8f34283ee in ?? () from /usr/lib64/libc.so.6
#74 0x00007fa8f34284a9 in __libc_start_main () from /usr/lib64/libc.so.6
#75 0x000055830fe9b085 in _start ()
[…]
gdb) up
#6  0x00007fa8f32e8cc5 in _zic_module_exec (module=<module at remote 0x7fa8f2320c20>)
    at src/zope/interface/_zope_interface_coptimizations.c:2571
2571        sb_class = PyType_FromModuleAndSpec(module, &SB_type_spec, NULL);
(gdb) p SB_type_spec 
$1 = {name = 0x7fa8f32ef3c0 <SB__name__> "_zope_interface_coptimizations.SpecificationBase", basicsize = 72, itemsize = 0, 
  flags = 17408, slots = 0x7fa8f32eff40 <SB_type_slots>}

What version of Python and Zope/Addons I am using:

Gentoo Linux amd64 Tested on 7.0.2 and c3a49451d9f56e519ce9747d7f381ee0e19a92e0.

davisagli commented 2 months ago

@mgorny Thanks for the report. I've released a fix in zope.interface 7.0.3

mgorny commented 2 months ago

Thanks. This version seems to work.