]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-35081: Move bytes_methods.h to the internal C API (GH-18492)
authorVictor Stinner <vstinner@python.org>
Wed, 12 Feb 2020 21:32:34 +0000 (22:32 +0100)
committerGitHub <noreply@github.com>
Wed, 12 Feb 2020 21:32:34 +0000 (22:32 +0100)
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.

Include/internal/pycore_bytes_methods.h [moved from Include/bytes_methods.h with 97% similarity]
Makefile.pre.in
Misc/NEWS.d/next/C API/2020-02-12-21-38-49.bpo-35081.5tj1yC.rst [new file with mode: 0644]
Objects/bytearrayobject.c
Objects/bytes_methods.c
Objects/bytesobject.c
Objects/stringlib/ctype.h
Objects/unicodeobject.c
PCbuild/pythoncore.vcxproj
PCbuild/pythoncore.vcxproj.filters

similarity index 97%
rename from Include/bytes_methods.h
rename to Include/internal/pycore_bytes_methods.h
index 8434a50a4bba717ee6c3a4428de3be3677e5c928..11e8ab20e91367ced72b6c7660201f77a0230cd1 100644 (file)
@@ -2,6 +2,10 @@
 #ifndef 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)
  * methods of the given names, they operate on ASCII byte strings.
index 3da104bac87d05e1e9b69f1b3047fa53f3f73aee..aae93ff82c145f8925f7946c4b53b04ebc79de5f 100644 (file)
@@ -970,7 +970,6 @@ PYTHON_HEADERS= \
                $(srcdir)/Include/bltinmodule.h \
                $(srcdir)/Include/boolobject.h \
                $(srcdir)/Include/bytearrayobject.h \
-               $(srcdir)/Include/bytes_methods.h \
                $(srcdir)/Include/bytesobject.h \
                $(srcdir)/Include/cellobject.h \
                $(srcdir)/Include/ceval.h \
@@ -1077,6 +1076,7 @@ PYTHON_HEADERS= \
                \
                $(srcdir)/Include/internal/pycore_accu.h \
                $(srcdir)/Include/internal/pycore_atomic.h \
+               $(srcdir)/Include/internal/pycore_bytes_methods.h \
                $(srcdir)/Include/internal/pycore_call.h \
                $(srcdir)/Include/internal/pycore_ceval.h \
                $(srcdir)/Include/internal/pycore_code.h \
diff --git a/Misc/NEWS.d/next/C API/2020-02-12-21-38-49.bpo-35081.5tj1yC.rst b/Misc/NEWS.d/next/C API/2020-02-12-21-38-49.bpo-35081.5tj1yC.rst
new file mode 100644 (file)
index 0000000..6be3320
--- /dev/null
@@ -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.
index a3fc35ca4d22aa4de71dafa971cbf7663cb99564..d3964358bc59de23e376b95a2eb5851762c8e472 100644 (file)
@@ -2,11 +2,11 @@
 
 #define PY_SSIZE_T_CLEAN
 #include "Python.h"
+#include "pycore_bytes_methods.h"
 #include "pycore_object.h"
 #include "pycore_pymem.h"
 #include "pycore_pystate.h"
 #include "structmember.h"
-#include "bytes_methods.h"
 #include "bytesobject.h"
 #include "pystrhex.h"
 
index db030be4fe7561600e8c968759e073981bc8d776..a4b3868e72522618834c7b4833d5601ea502d0eb 100644 (file)
@@ -1,6 +1,6 @@
 #define PY_SSIZE_T_CLEAN
 #include "Python.h"
-#include "bytes_methods.h"
+#include "pycore_bytes_methods.h"
 
 PyDoc_STRVAR_shared(_Py_isspace__doc__,
 "B.isspace() -> bool\n\
index df3eddae6a36d3d00c25e6aec56af818bdaea394..bd8af72ade5d3d9beeed085744a1ba1a47dafa7b 100644 (file)
@@ -3,11 +3,11 @@
 #define PY_SSIZE_T_CLEAN
 
 #include "Python.h"
+#include "pycore_bytes_methods.h"
 #include "pycore_object.h"
 #include "pycore_pymem.h"
 #include "pycore_pystate.h"
 
-#include "bytes_methods.h"
 #include "pystrhex.h"
 #include <stddef.h>
 
index 843cfa22a84546d409b9d84e2ba69d3a6527a506..9b319b07d11bcb503cb7d52e77ca5bfbd236e83c 100644 (file)
@@ -2,7 +2,7 @@
 # error "ctype.h only compatible with byte-wise strings"
 #endif
 
-#include "bytes_methods.h"
+#include "pycore_bytes_methods.h"
 
 static PyObject*
 stringlib_isspace(PyObject *self, PyObject *Py_UNUSED(ignored))
index 8470e41624bd44e1a36d0feaa5ece7de6a3e97f8..11fa1fb5ff798e05b075f99b051b226a63106697 100644 (file)
@@ -40,6 +40,7 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 
 #define PY_SSIZE_T_CLEAN
 #include "Python.h"
+#include "pycore_bytes_methods.h"
 #include "pycore_fileutils.h"
 #include "pycore_initconfig.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_pystate.h"
 #include "ucnhash.h"
-#include "bytes_methods.h"
 #include "stringlib/eq.h"
 
 #ifdef MS_WINDOWS
index 36a27f467405d5e614f0640f80afb9530a932953..a3719d8558de7f41c7ddd0546383cd894898482c 100644 (file)
     <ClInclude Include="..\Include\ast.h" />
     <ClInclude Include="..\Include\bitset.h" />
     <ClInclude Include="..\Include\boolobject.h" />
-    <ClInclude Include="..\Include\bytes_methods.h" />
     <ClInclude Include="..\Include\bytearrayobject.h" />
     <ClInclude Include="..\Include\bytesobject.h" />
     <ClInclude Include="..\Include\cellobject.h" />
     <ClInclude Include="..\Include\import.h" />
     <ClInclude Include="..\Include\internal\pycore_accu.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_ceval.h" />
     <ClInclude Include="..\Include\internal\pycore_code.h" />
index 0301557b3e50d9ad3ca183e3c2c557ada07844ae..67e223dab4396e05ba3c0876d42d3a4168a9c486 100644 (file)
@@ -48,9 +48,6 @@
     <ClInclude Include="..\Include\boolobject.h">
       <Filter>Include</Filter>
     </ClInclude>
-    <ClInclude Include="..\Include\bytes_methods.h">
-      <Filter>Include</Filter>
-    </ClInclude>
     <ClInclude Include="..\Include\bytearrayobject.h">
       <Filter>Include</Filter>
     </ClInclude>
     <ClInclude Include="..\Include\internal\pycore_atomic.h">
       <Filter>Include</Filter>
     </ClInclude>
+    <ClInclude Include="..\Include\internal\pycore_bytes_methods.h">
+      <Filter>Include</Filter>
+    </ClInclude>
     <ClInclude Include="..\Include\internal\pycore_call.h">
       <Filter>Include</Filter>
     </ClInclude>