Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 34k
Closed
Labels
type-crashA hard crash of the interpreter, possibly with a core dumpA hard crash of the interpreter, possibly with a core dump
Description
Crash report
What happened?
Consider the following extension.
C code:
#include<Python.h>staticPyObject*foo_bar(PyObject*self, PyObject*args){Py_INCREF(PyExc_TypeError); PyErr_SetString(PyExc_TypeError, "foo"); returnNULL} staticPyMethodDeffoomethods[] ={{"bar", foo_bar, METH_VARARGS, ""},{NULL, NULL, 0, NULL}, }; staticPyModuleDeffoomodule={PyModuleDef_HEAD_INIT, .m_name="foo", .m_doc="foo test module", .m_size=-1, .m_methods=foomethods, }; PyMODINIT_FUNCPyInit_foo(void){returnPyModule_Create(&foomodule)}setup.py:
fromsetuptoolsimportsetup, Extensionsetup(name='foo', version='0', ext_modules=[ Extension('foo', ['foo.c'], py_limited_api='cp38'), ])If I compile the extension using Python older than 3.12, and then run the method, Python 3.13.0b3 (built --with-assertions) crashes:
$ python3.11 setup.py build_ext -i running build_ext building 'foo' extension creating build creating build/temp.linux-x86_64-cpython-311 x86_64-pc-linux-gnu-gcc -Wsign-compare -fPIC -I/usr/include/python3.11 -c foo.c -o build/temp.linux-x86_64-cpython-311/foo.o creating build/lib.linux-x86_64-cpython-311 x86_64-pc-linux-gnu-gcc -shared build/temp.linux-x86_64-cpython-311/foo.o -L/usr/lib64 -o build/lib.linux-x86_64-cpython-311/foo.abi3.so copying build/lib.linux-x86_64-cpython-311/foo.abi3.so -> $ python3.13 -c 'import foo; foo.bar()' python3.13: ./Include/internal/pycore_object.h:284: _PyObject_Init: Assertion `_PyType_HasFeature(typeobj, Py_TPFLAGS_HEAPTYPE) || _Py_IsImmortal(typeobj)' failed. Aborted (core dumped) I've been able to bisect it to c32dc47 (CC @markshannon). Originally hit it in extensions using PyO3, and reported to PyO3/pyo3#4311.
CPython versions tested on:
CPython main branch
Operating systems tested on:
Linux
Output from running 'python -VV' on the command line:
Python 3.13.0b3 (main, Jul 4 2024, 14:30:57) [GCC 14.1.1 20240622]
Linked PRs
Metadata
Metadata
Assignees
Labels
type-crashA hard crash of the interpreter, possibly with a core dumpA hard crash of the interpreter, possibly with a core dump