bpo-35081: Move bytes_methods.h to the internal C API (GH-18492)

Move the bytes_methods.h header file to the internal C API as
pycore_bytes_methods.h: it only contains private symbols (prefixed by
"_Py"), except of the PyDoc_STRVAR_shared() macro.
This commit is contained in:
Victor Stinner 2020-02-12 22:32:34 +01:00 committed by GitHub
parent 6e619c48b8
commit 45876a90e2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 17 additions and 10 deletions

View File

@ -2,6 +2,10 @@
#ifndef Py_BYTES_CTYPE_H #ifndef Py_BYTES_CTYPE_H
#define Py_BYTES_CTYPE_H #define Py_BYTES_CTYPE_H
#ifndef Py_BUILD_CORE
# error "this header requires Py_BUILD_CORE define"
#endif
/* /*
* The internal implementation behind PyBytes (bytes) and PyByteArray (bytearray) * The internal implementation behind PyBytes (bytes) and PyByteArray (bytearray)
* methods of the given names, they operate on ASCII byte strings. * methods of the given names, they operate on ASCII byte strings.

View File

@ -970,7 +970,6 @@ PYTHON_HEADERS= \
$(srcdir)/Include/bltinmodule.h \ $(srcdir)/Include/bltinmodule.h \
$(srcdir)/Include/boolobject.h \ $(srcdir)/Include/boolobject.h \
$(srcdir)/Include/bytearrayobject.h \ $(srcdir)/Include/bytearrayobject.h \
$(srcdir)/Include/bytes_methods.h \
$(srcdir)/Include/bytesobject.h \ $(srcdir)/Include/bytesobject.h \
$(srcdir)/Include/cellobject.h \ $(srcdir)/Include/cellobject.h \
$(srcdir)/Include/ceval.h \ $(srcdir)/Include/ceval.h \
@ -1077,6 +1076,7 @@ PYTHON_HEADERS= \
\ \
$(srcdir)/Include/internal/pycore_accu.h \ $(srcdir)/Include/internal/pycore_accu.h \
$(srcdir)/Include/internal/pycore_atomic.h \ $(srcdir)/Include/internal/pycore_atomic.h \
$(srcdir)/Include/internal/pycore_bytes_methods.h \
$(srcdir)/Include/internal/pycore_call.h \ $(srcdir)/Include/internal/pycore_call.h \
$(srcdir)/Include/internal/pycore_ceval.h \ $(srcdir)/Include/internal/pycore_ceval.h \
$(srcdir)/Include/internal/pycore_code.h \ $(srcdir)/Include/internal/pycore_code.h \

View File

@ -0,0 +1,3 @@
Move the ``bytes_methods.h`` header file to the internal C API as
``pycore_bytes_methods.h``: it only contains private symbols (prefixed by
``_Py``), except of the ``PyDoc_STRVAR_shared()`` macro.

View File

@ -2,11 +2,11 @@
#define PY_SSIZE_T_CLEAN #define PY_SSIZE_T_CLEAN
#include "Python.h" #include "Python.h"
#include "pycore_bytes_methods.h"
#include "pycore_object.h" #include "pycore_object.h"
#include "pycore_pymem.h" #include "pycore_pymem.h"
#include "pycore_pystate.h" #include "pycore_pystate.h"
#include "structmember.h" #include "structmember.h"
#include "bytes_methods.h"
#include "bytesobject.h" #include "bytesobject.h"
#include "pystrhex.h" #include "pystrhex.h"

View File

@ -1,6 +1,6 @@
#define PY_SSIZE_T_CLEAN #define PY_SSIZE_T_CLEAN
#include "Python.h" #include "Python.h"
#include "bytes_methods.h" #include "pycore_bytes_methods.h"
PyDoc_STRVAR_shared(_Py_isspace__doc__, PyDoc_STRVAR_shared(_Py_isspace__doc__,
"B.isspace() -> bool\n\ "B.isspace() -> bool\n\

View File

@ -3,11 +3,11 @@
#define PY_SSIZE_T_CLEAN #define PY_SSIZE_T_CLEAN
#include "Python.h" #include "Python.h"
#include "pycore_bytes_methods.h"
#include "pycore_object.h" #include "pycore_object.h"
#include "pycore_pymem.h" #include "pycore_pymem.h"
#include "pycore_pystate.h" #include "pycore_pystate.h"
#include "bytes_methods.h"
#include "pystrhex.h" #include "pystrhex.h"
#include <stddef.h> #include <stddef.h>

View File

@ -2,7 +2,7 @@
# error "ctype.h only compatible with byte-wise strings" # error "ctype.h only compatible with byte-wise strings"
#endif #endif
#include "bytes_methods.h" #include "pycore_bytes_methods.h"
static PyObject* static PyObject*
stringlib_isspace(PyObject *self, PyObject *Py_UNUSED(ignored)) stringlib_isspace(PyObject *self, PyObject *Py_UNUSED(ignored))

View File

@ -40,6 +40,7 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#define PY_SSIZE_T_CLEAN #define PY_SSIZE_T_CLEAN
#include "Python.h" #include "Python.h"
#include "pycore_bytes_methods.h"
#include "pycore_fileutils.h" #include "pycore_fileutils.h"
#include "pycore_initconfig.h" #include "pycore_initconfig.h"
#include "pycore_object.h" #include "pycore_object.h"
@ -47,7 +48,6 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include "pycore_pylifecycle.h" #include "pycore_pylifecycle.h"
#include "pycore_pystate.h" #include "pycore_pystate.h"
#include "ucnhash.h" #include "ucnhash.h"
#include "bytes_methods.h"
#include "stringlib/eq.h" #include "stringlib/eq.h"
#ifdef MS_WINDOWS #ifdef MS_WINDOWS

View File

@ -115,7 +115,6 @@
<ClInclude Include="..\Include\ast.h" /> <ClInclude Include="..\Include\ast.h" />
<ClInclude Include="..\Include\bitset.h" /> <ClInclude Include="..\Include\bitset.h" />
<ClInclude Include="..\Include\boolobject.h" /> <ClInclude Include="..\Include\boolobject.h" />
<ClInclude Include="..\Include\bytes_methods.h" />
<ClInclude Include="..\Include\bytearrayobject.h" /> <ClInclude Include="..\Include\bytearrayobject.h" />
<ClInclude Include="..\Include\bytesobject.h" /> <ClInclude Include="..\Include\bytesobject.h" />
<ClInclude Include="..\Include\cellobject.h" /> <ClInclude Include="..\Include\cellobject.h" />
@ -161,6 +160,7 @@
<ClInclude Include="..\Include\import.h" /> <ClInclude Include="..\Include\import.h" />
<ClInclude Include="..\Include\internal\pycore_accu.h" /> <ClInclude Include="..\Include\internal\pycore_accu.h" />
<ClInclude Include="..\Include\internal\pycore_atomic.h" /> <ClInclude Include="..\Include\internal\pycore_atomic.h" />
<ClInclude Include="..\Include\internal\pycore_bytes_methods.h" />
<ClInclude Include="..\Include\internal\pycore_call.h" /> <ClInclude Include="..\Include\internal\pycore_call.h" />
<ClInclude Include="..\Include\internal\pycore_ceval.h" /> <ClInclude Include="..\Include\internal\pycore_ceval.h" />
<ClInclude Include="..\Include\internal\pycore_code.h" /> <ClInclude Include="..\Include\internal\pycore_code.h" />

View File

@ -48,9 +48,6 @@
<ClInclude Include="..\Include\boolobject.h"> <ClInclude Include="..\Include\boolobject.h">
<Filter>Include</Filter> <Filter>Include</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\Include\bytes_methods.h">
<Filter>Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\bytearrayobject.h"> <ClInclude Include="..\Include\bytearrayobject.h">
<Filter>Include</Filter> <Filter>Include</Filter>
</ClInclude> </ClInclude>
@ -186,6 +183,9 @@
<ClInclude Include="..\Include\internal\pycore_atomic.h"> <ClInclude Include="..\Include\internal\pycore_atomic.h">
<Filter>Include</Filter> <Filter>Include</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\Include\internal\pycore_bytes_methods.h">
<Filter>Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\internal\pycore_call.h"> <ClInclude Include="..\Include\internal\pycore_call.h">
<Filter>Include</Filter> <Filter>Include</Filter>
</ClInclude> </ClInclude>