[issue35081] Rename Include/internals/ to Include/pycore/
STINNER Victor
report at bugs.python.org
Fri Oct 26 20:42:24 EDT 2018
New submission from STINNER Victor <vstinner at redhat.com>:
Currently, #include "pymem.h" may include Include/pymem.h or Include/internal/pymem.h depending where is the C file (.c) and if Include/internal/ is in the header search path or not.
I propose to:
* Rename Include/internal/ to Include/pycore/
* In this subdirectory, rename xxx.h to pycore_xxx.h to avoid any risk of confusion
* Automatically include pycore_xxx.h in xxx.h if Py_BUILD_CORE is defined: this should avoid the need of explicit #include "internal/xxx.h" in C files
For example, Include/internal/pystate.h becomes Include/pycore/pycore_pystate.h.
Attached PR implements this idea.
I chose to rename "internal" subdirectory to "pycore" to prepare the addition of other subdirectories. See:
* https://pythoncapi.readthedocs.io/split_include.html
* https://pythoncapi.readthedocs.io/
Next steps:
* Move all code surrounded by #ifdef Py_BUILD_CORE from Include/*.h into Include/pycore/*.h: see the second commit of my PR for an example
* Move core surrounded by #ifndef Py_LIMITED_API from Include/*.h into Include/limited/ (example of filename: Include/limited/limited_object.h)
This change should be backward compatible since Include/internal/ must not be used outside CPython core. If someone does that, well, be ready for breakage :-) It's not supported.
----------
components: Interpreter Core
messages: 328619
nosy: vstinner
priority: normal
severity: normal
status: open
title: Rename Include/internals/ to Include/pycore/
versions: Python 3.8
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue35081>
_______________________________________
More information about the Python-bugs-list
mailing list