]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-35081: Move interpreteridobject.h to Include/internal/ (GH-28969)
authorVictor Stinner <vstinner@python.org>
Fri, 15 Oct 2021 09:56:34 +0000 (11:56 +0200)
committerGitHub <noreply@github.com>
Fri, 15 Oct 2021 09:56:34 +0000 (11:56 +0200)
Move the interpreteridobject.h header file from Include/ to
Include/internal/. It only provides private functions.

Include/internal/pycore_interpreteridobject.h [moved from Include/cpython/interpreteridobject.h with 51% similarity]
Include/internal/pycore_pymem.h
Include/interpreteridobject.h [deleted file]
Makefile.pre.in
Misc/NEWS.d/next/C API/2021-10-15-09-29-59.bpo-35081.2teFD3.rst [new file with mode: 0644]
Modules/_xxsubinterpretersmodule.c
Objects/interpreteridobject.c
Objects/object.c
PCbuild/pythoncore.vcxproj
PCbuild/pythoncore.vcxproj.filters
Tools/c-analyzer/cpython/_parser.py

similarity index 51%
rename from Include/cpython/interpreteridobject.h
rename to Include/internal/pycore_interpreteridobject.h
index 5076584209b90b4f8309913b9ade0fd121f8d526..804831e76deaeac213e122f6373bc1812d5af8ff 100644 (file)
@@ -1,11 +1,22 @@
-#ifndef Py_CPYTHON_INTERPRETERIDOBJECT_H
-#  error "this header file must not be included directly"
+/* Interpreter ID Object */
+
+#ifndef Py_INTERNAL_INTERPRETERIDOBJECT_H
+#define Py_INTERNAL_INTERPRETERIDOBJECT_H
+#ifdef __cplusplus
+extern "C" {
 #endif
 
-/* Interpreter ID Object */
+#ifndef Py_BUILD_CORE
+#  error "this header requires Py_BUILD_CORE define"
+#endif
 
 PyAPI_DATA(PyTypeObject) _PyInterpreterID_Type;
 
 PyAPI_FUNC(PyObject *) _PyInterpreterID_New(int64_t);
 PyAPI_FUNC(PyObject *) _PyInterpreterState_GetIDObject(PyInterpreterState *);
 PyAPI_FUNC(PyInterpreterState *) _PyInterpreterID_LookUp(PyObject *);
+
+#ifdef __cplusplus
+}
+#endif
+#endif  // !Py_INTERNAL_INTERPRETERIDOBJECT_H
index 30db3f2b6701ecbd1b9e20a1163705489a5d501f..d70deee710e30d40a539b3e6593729a0056d4a30 100644 (file)
@@ -103,4 +103,4 @@ void _PyObject_VirtualFree(void *, size_t size);
 #ifdef __cplusplus
 }
 #endif
-#endif /* !Py_INTERNAL_PYMEM_H */
+#endif  // !Py_INTERNAL_PYMEM_H
diff --git a/Include/interpreteridobject.h b/Include/interpreteridobject.h
deleted file mode 100644 (file)
index 8432632..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-#ifndef Py_INTERPRETERIDOBJECT_H
-#define Py_INTERPRETERIDOBJECT_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifndef Py_LIMITED_API
-#  define Py_CPYTHON_INTERPRETERIDOBJECT_H
-#  include "cpython/interpreteridobject.h"
-#  undef Py_CPYTHON_INTERPRETERIDOBJECT_H
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* !Py_INTERPRETERIDOBJECT_H */
index a81161e147d30beba57f3d00809ba413789921cd..ccce52b36c42e202d7b626b91dca2bcf7dfc410a 100644 (file)
@@ -1143,7 +1143,6 @@ PYTHON_HEADERS= \
                $(srcdir)/Include/floatobject.h \
                $(srcdir)/Include/frameobject.h \
                $(srcdir)/Include/import.h \
-               $(srcdir)/Include/interpreteridobject.h \
                $(srcdir)/Include/intrcheck.h \
                $(srcdir)/Include/iterobject.h \
                $(srcdir)/Include/listobject.h \
@@ -1211,7 +1210,6 @@ PYTHON_HEADERS= \
                $(srcdir)/Include/cpython/genobject.h \
                $(srcdir)/Include/cpython/import.h \
                $(srcdir)/Include/cpython/initconfig.h \
-               $(srcdir)/Include/cpython/interpreteridobject.h \
                $(srcdir)/Include/cpython/listobject.h \
                $(srcdir)/Include/cpython/longintrepr.h \
                $(srcdir)/Include/cpython/methodobject.h \
@@ -1260,6 +1258,7 @@ PYTHON_HEADERS= \
                $(srcdir)/Include/internal/pycore_import.h \
                $(srcdir)/Include/internal/pycore_initconfig.h \
                $(srcdir)/Include/internal/pycore_interp.h \
+               $(srcdir)/Include/internal/pycore_interpreteridobject.h \
                $(srcdir)/Include/internal/pycore_list.h \
                $(srcdir)/Include/internal/pycore_long.h \
                $(srcdir)/Include/internal/pycore_moduleobject.h \
diff --git a/Misc/NEWS.d/next/C API/2021-10-15-09-29-59.bpo-35081.2teFD3.rst b/Misc/NEWS.d/next/C API/2021-10-15-09-29-59.bpo-35081.2teFD3.rst
new file mode 100644 (file)
index 0000000..79d4a9b
--- /dev/null
@@ -0,0 +1,3 @@
+Move the ``interpreteridobject.h`` header file from ``Include/`` to
+``Include/internal/``. It only provides private functions. Patch by Victor
+Stinner.
index 939114e60cae9715119e17e60a0ced5a24448a3a..b5c0a632191146f680d10b6477ca291128ced218 100644 (file)
@@ -6,7 +6,7 @@
 #include "frameobject.h"
 #include "pycore_frame.h"
 #include "pycore_pystate.h"       // _PyThreadState_GET()
-#include "interpreteridobject.h"
+#include "pycore_interpreteridobject.h"
 
 
 static char *
index 46239100dcb7b77415ad4bcecd66c42729d5b4b4..7b3e31beded5947701c1f6e040d5a3a1eddc9329 100644 (file)
@@ -3,7 +3,7 @@
 #include "Python.h"
 #include "pycore_abstract.h"   // _PyIndex_Check()
 #include "pycore_interp.h"     // _PyInterpreterState_LookUpID()
-#include "interpreteridobject.h"
+#include "pycore_interpreteridobject.h"
 
 
 typedef struct interpid {
index 589dd6647318dafae5dd14e8a7e4855bdb33ebcf..5e719d45b60a696f21afb3f9bbc6b04185c06d3a 100644 (file)
@@ -16,7 +16,7 @@
 #include "pycore_symtable.h"      // PySTEntry_Type
 #include "pycore_unionobject.h"   // _PyUnion_Type
 #include "frameobject.h"          // PyFrame_Type
-#include "interpreteridobject.h"  // _PyInterpreterID_Type
+#include "pycore_interpreteridobject.h"  // _PyInterpreterID_Type
 
 #ifdef Py_LIMITED_API
    // Prevent recursive call _Py_IncRef() <=> Py_INCREF()
index 0b0ff45621dcb8e4eab19da4e96d27c30729eac1..32511d2a66511326f2a7fecbf215e72e21a71d89 100644 (file)
     <ClInclude Include="..\Include\cpython\genobject.h" />
     <ClInclude Include="..\Include\cpython\import.h" />
     <ClInclude Include="..\Include\cpython\initconfig.h" />
-    <ClInclude Include="..\Include\cpython\interpreteridobject.h" />
     <ClInclude Include="..\Include\cpython\listobject.h" />
     <ClInclude Include="..\Include\cpython\longintrepr.h" />
     <ClInclude Include="..\Include\cpython\methodobject.h" />
     <ClInclude Include="..\Include\internal\pycore_import.h" />
     <ClInclude Include="..\Include\internal\pycore_initconfig.h" />
     <ClInclude Include="..\Include\internal\pycore_interp.h" />
+    <ClInclude Include="..\Include\internal\pycore_interpreteridobject.h" />
     <ClInclude Include="..\Include\internal\pycore_list.h" />
     <ClInclude Include="..\Include\internal\pycore_long.h" />
     <ClInclude Include="..\Include\internal\pycore_moduleobject.h" />
     <ClInclude Include="..\Include\internal\pycore_ucnhash.h" />
     <ClInclude Include="..\Include\internal\pycore_unionobject.h" />
     <ClInclude Include="..\Include\internal\pycore_warnings.h" />
-    <ClInclude Include="..\Include\interpreteridobject.h" />
     <ClInclude Include="..\Include\intrcheck.h" />
     <ClInclude Include="..\Include\iterobject.h" />
     <ClInclude Include="..\Include\listobject.h" />
index 17794fce88bc8100279ff9bd37dca921d5c135b0..4cc1092b33a496872e864a6880feab08f2108827 100644 (file)
     <ClInclude Include="..\Include\namespaceobject.h">
       <Filter>Include</Filter>
     </ClInclude>
-    <ClInclude Include="..\Include\interpreteridobject.h">
-      <Filter>Include</Filter>
-    </ClInclude>
     <ClInclude Include="..\Modules\hashtable.h">
       <Filter>Modules</Filter>
     </ClInclude>
     <ClInclude Include="..\Include\cpython\genobject.h">
       <Filter>Include</Filter>
     </ClInclude>
-    <ClInclude Include="..\Include\cpython\interpreteridobject.h">
-      <Filter>Include\cpython</Filter>
-    </ClInclude>
     <ClInclude Include="..\Include\cpython\pythonrun.h">
       <Filter>Include\cpython</Filter>
     </ClInclude>
     <ClInclude Include="..\Include\internal\pycore_interp.h">
       <Filter>Include\internal</Filter>
     </ClInclude>
+    <ClInclude Include="..\Include\internal\pycore_interpreteridobject.h">
+      <Filter>Include\cpython</Filter>
+    </ClInclude>
     <ClInclude Include="..\Include\internal\pycore_list.h">
       <Filter>Include\internal</Filter>
     </ClInclude>
index ef06a9fcb6903387cfd657295513b30296ccd59e..8526b2af15a235d8195e4ce9ea21096298d1e67d 100644 (file)
@@ -172,7 +172,6 @@ Include/cpython/fileobject.h        Py_CPYTHON_FILEOBJECT_H 1
 Include/cpython/fileutils.h    Py_CPYTHON_FILEUTILS_H  1
 Include/cpython/frameobject.h  Py_CPYTHON_FRAMEOBJECT_H        1
 Include/cpython/import.h       Py_CPYTHON_IMPORT_H     1
-Include/cpython/interpreteridobject.h  Py_CPYTHON_INTERPRETERIDOBJECT_H        1
 Include/cpython/listobject.h   Py_CPYTHON_LISTOBJECT_H 1
 Include/cpython/methodobject.h Py_CPYTHON_METHODOBJECT_H       1
 Include/cpython/object.h       Py_CPYTHON_OBJECT_H     1