[Python-Dev] What is the difference between Py_BUILD_CORE and Py_BUILD_CORE_BUILTIN?

Victor Stinner vstinner at redhat.com
Tue Nov 6 10:09:09 EST 2018


I'm trying to cleanup the Python C API, especially strictly separate
the public C API, the stable C API (Py_LIMITED_API), and the internal

Move internal headers to Include/internal/ :

Move !Py_LIMITED_API to Include/pycapi/:

I tried to ensure that Py_BUILD_CORE is defined when including
pycore_xxx.h headers from Include/internal/, but the compilation of
the _json module fails. Modules/_json.c contains:

/* Core extension modules are built-in on some platforms (e.g. Windows). */
#ifdef Py_BUILD_CORE
#undef Py_BUILD_CORE

I don't understand the difference between Py_BUILD_CORE and
Py_BUILD_CORE_BUILTIN defines. Do we need to have two different
defines? Can't we compile _json with Py_BUILD_CORE?

_json.c uses pycore_accu.h:

 * A two-level accumulator of unicode objects that avoids both the overhead
 * of keeping a huge number of small separate objects, and the quadratic
 * behaviour of using a naive repeated concatenation scheme.

Is it a problem of the visibility/scope of symbols in the python DLL on Windows?


More information about the Python-Dev mailing list