CPython main branch
Operating systems tested on:Linux
Output from running 'python -VV' on the command line:No response
A clear and concise description of the bug:Trying to build a C extension targetting the limited C API (defining Py_LIMITED_API) fails if Python is configured with ./configure --with-trace-refs
. Example with PR #108573:
In file included from ./Include/Python.h:44,
from ./Modules/_stat.c:16:
./Include/object.h:62:4: error: #error Py_LIMITED_API is incompatible with Py_TRACE_REFS
62 | # error Py_LIMITED_API is incompatible with Py_TRACE_REFS
| ^~~~~
make: *** [Makefile:3194: Modules/_stat.o] Error 1
The #error
comes from Include/object.h
:
#if defined(Py_LIMITED_API) && defined(Py_TRACE_REFS) # error Py_LIMITED_API is incompatible with Py_TRACE_REFS #endif
The problem is that the PyObject ABI is different: Py_TRACE_REFS adds two members to PyObject structure:
PyObject *_ob_next; PyObject *_ob_prev;
One solution to make Py_TRACE_REFS compatible with Py_LIMITED_API would be to not add these two members to PyObject, but store the double-linked list outside PyObject
. Store it in a different structure, so PyObject
stays ABI compatible.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4