bpo-35081: Move bytes_methods.h to the internal C API (GH-18492) · python/cpython@45876a9 (original) (raw)

10 files changed

lines changed

Original file line number Diff line number Diff line change
@@ -2,6 +2,10 @@
2 2 #ifndef Py_BYTES_CTYPE_H
3 3 #define Py_BYTES_CTYPE_H
4 4
5 +#ifndef Py_BUILD_CORE
6 +# error "this header requires Py_BUILD_CORE define"
7 +#endif
8 +
5 9 /*
6 10 * The internal implementation behind PyBytes (bytes) and PyByteArray (bytearray)
7 11 * methods of the given names, they operate on ASCII byte strings.
Original file line number Diff line number Diff line change
@@ -970,7 +970,6 @@ PYTHON_HEADERS= \
970 970 $(srcdir)/Include/bltinmodule.h \
971 971 $(srcdir)/Include/boolobject.h \
972 972 $(srcdir)/Include/bytearrayobject.h \
973 - $(srcdir)/Include/bytes_methods.h \
974 973 $(srcdir)/Include/bytesobject.h \
975 974 $(srcdir)/Include/cellobject.h \
976 975 $(srcdir)/Include/ceval.h \
@@ -1077,6 +1076,7 @@ PYTHON_HEADERS= \
1077 1076 \
1078 1077 $(srcdir)/Include/internal/pycore_accu.h \
1079 1078 $(srcdir)/Include/internal/pycore_atomic.h \
1079 + $(srcdir)/Include/internal/pycore_bytes_methods.h \
1080 1080 $(srcdir)/Include/internal/pycore_call.h \
1081 1081 $(srcdir)/Include/internal/pycore_ceval.h \
1082 1082 $(srcdir)/Include/internal/pycore_code.h \
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
1 +Move the ``bytes_methods.h`` header file to the internal C API as
2 +``pycore_bytes_methods.h``: it only contains private symbols (prefixed by
3 +``_Py``), except of the ``PyDoc_STRVAR_shared()`` macro.
Original file line number Diff line number Diff line change
@@ -2,11 +2,11 @@
2 2
3 3 #define PY_SSIZE_T_CLEAN
4 4 #include "Python.h"
5 +#include "pycore_bytes_methods.h"
5 6 #include "pycore_object.h"
6 7 #include "pycore_pymem.h"
7 8 #include "pycore_pystate.h"
8 9 #include "structmember.h"
9 -#include "bytes_methods.h"
10 10 #include "bytesobject.h"
11 11 #include "pystrhex.h"
12 12
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
1 1 #define PY_SSIZE_T_CLEAN
2 2 #include "Python.h"
3 -#include "bytes_methods.h"
3 +#include "pycore_bytes_methods.h"
4 4
5 5 PyDoc_STRVAR_shared(_Py_isspace__doc__,
6 6 "B.isspace() -> bool\n\
Original file line number Diff line number Diff line change
@@ -3,11 +3,11 @@
3 3 #define PY_SSIZE_T_CLEAN
4 4
5 5 #include "Python.h"
6 +#include "pycore_bytes_methods.h"
6 7 #include "pycore_object.h"
7 8 #include "pycore_pymem.h"
8 9 #include "pycore_pystate.h"
9 10
10 -#include "bytes_methods.h"
11 11 #include "pystrhex.h"
12 12 #include <stddef.h>
13 13
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@
2 2 # error "ctype.h only compatible with byte-wise strings"
3 3 #endif
4 4
5 -#include "bytes_methods.h"
5 +#include "pycore_bytes_methods.h"
6 6
7 7 static PyObject*
8 8 stringlib_isspace(PyObject *self, PyObject *Py_UNUSED(ignored))
Original file line number Diff line number Diff line change
@@ -40,14 +40,14 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
40 40
41 41 #define PY_SSIZE_T_CLEAN
42 42 #include "Python.h"
43 +#include "pycore_bytes_methods.h"
43 44 #include "pycore_fileutils.h"
44 45 #include "pycore_initconfig.h"
45 46 #include "pycore_object.h"
46 47 #include "pycore_pathconfig.h"
47 48 #include "pycore_pylifecycle.h"
48 49 #include "pycore_pystate.h"
49 50 #include "ucnhash.h"
50 -#include "bytes_methods.h"
51 51 #include "stringlib/eq.h"
52 52
53 53 #ifdef MS_WINDOWS
Original file line number Diff line number Diff line change
@@ -115,7 +115,6 @@
115 115 <ClInclude Include="..\Include\ast.h" />
116 116 <ClInclude Include="..\Include\bitset.h" />
117 117 <ClInclude Include="..\Include\boolobject.h" />
118 - <ClInclude Include="..\Include\bytes_methods.h" />
119 118 <ClInclude Include="..\Include\bytearrayobject.h" />
120 119 <ClInclude Include="..\Include\bytesobject.h" />
121 120 <ClInclude Include="..\Include\cellobject.h" />
@@ -161,6 +160,7 @@
161 160 <ClInclude Include="..\Include\import.h" />
162 161 <ClInclude Include="..\Include\internal\pycore_accu.h" />
163 162 <ClInclude Include="..\Include\internal\pycore_atomic.h" />
163 + <ClInclude Include="..\Include\internal\pycore_bytes_methods.h" />
164 164 <ClInclude Include="..\Include\internal\pycore_call.h" />
165 165 <ClInclude Include="..\Include\internal\pycore_ceval.h" />
166 166 <ClInclude Include="..\Include\internal\pycore_code.h" />
Original file line number Diff line number Diff line change
@@ -48,9 +48,6 @@
48 48 <ClInclude Include="..\Include\boolobject.h">
49 49 <Filter>Include</Filter>
50 50 </ClInclude>
51 - <ClInclude Include="..\Include\bytes_methods.h">
52 - <Filter>Include</Filter>
53 - </ClInclude>
54 51 <ClInclude Include="..\Include\bytearrayobject.h">
55 52 <Filter>Include</Filter>
56 53 </ClInclude>
@@ -186,6 +183,9 @@
186 183 <ClInclude Include="..\Include\internal\pycore_atomic.h">
187 184 <Filter>Include</Filter>
188 185 </ClInclude>
186 + <ClInclude Include="..\Include\internal\pycore_bytes_methods.h">
187 + <Filter>Include</Filter>
188 + </ClInclude>
189 189 <ClInclude Include="..\Include\internal\pycore_call.h">
190 190 <Filter>Include</Filter>
191 191 </ClInclude>