]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-108240: Add pycore_capsule.h internal header file (#108596)
authorVictor Stinner <vstinner@python.org>
Tue, 29 Aug 2023 01:20:02 +0000 (03:20 +0200)
committerGitHub <noreply@github.com>
Tue, 29 Aug 2023 01:20:02 +0000 (01:20 +0000)
Move _PyCapsule_SetTraverse() definition to a new internal header
file: pycore_capsule.h.

Include/internal/pycore_capsule.h [new file with mode: 0644]
Include/pycapsule.h
Makefile.pre.in
Modules/socketmodule.c
Objects/capsule.c
PCbuild/pythoncore.vcxproj
PCbuild/pythoncore.vcxproj.filters

diff --git a/Include/internal/pycore_capsule.h b/Include/internal/pycore_capsule.h
new file mode 100644 (file)
index 0000000..aa2c67f
--- /dev/null
@@ -0,0 +1,17 @@
+#ifndef Py_INTERNAL_PYCAPSULE_H
+#define Py_INTERNAL_PYCAPSULE_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef Py_BUILD_CORE
+#  error "this header requires Py_BUILD_CORE define"
+#endif
+
+// Export for '_socket' shared extension
+PyAPI_FUNC(int) _PyCapsule_SetTraverse(PyObject *op, traverseproc traverse_func, inquiry clear_func);
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* !Py_INTERNAL_PYCAPSULE_H */
index 8660e83088edd6130f3e54df02b5eaf268daebe5..666b9f8673967051856b1b74f5aca5ce95f620df 100644 (file)
@@ -48,15 +48,10 @@ PyAPI_FUNC(int) PyCapsule_SetName(PyObject *capsule, const char *name);
 
 PyAPI_FUNC(int) PyCapsule_SetContext(PyObject *capsule, void *context);
 
-#ifdef Py_BUILD_CORE
-PyAPI_FUNC(int) _PyCapsule_SetTraverse(PyObject *op, traverseproc traverse_func, inquiry clear_func);
-#endif
-
 PyAPI_FUNC(void *) PyCapsule_Import(
     const char *name,           /* UTF-8 encoded string */
     int no_block);
 
-
 #ifdef __cplusplus
 }
 #endif
index 62a55bb2478fe4450ef4ac40bcb4bb137f8aa9c0..310caa94b9e4764197a1b6d6ba31d8cb697bcb18 100644 (file)
@@ -1743,6 +1743,7 @@ PYTHON_HEADERS= \
                $(srcdir)/Include/internal/pycore_bytes_methods.h \
                $(srcdir)/Include/internal/pycore_bytesobject.h \
                $(srcdir)/Include/internal/pycore_call.h \
+               $(srcdir)/Include/internal/pycore_capsule.h \
                $(srcdir)/Include/internal/pycore_ceval.h \
                $(srcdir)/Include/internal/pycore_ceval_state.h \
                $(srcdir)/Include/internal/pycore_code.h \
index 8cc45e22549f3094e768bbc0afc7c280a99d3f1d..e3681853dad095c05c83d09b7bc4aea1a2275dee 100644 (file)
@@ -106,6 +106,7 @@ Local naming conventions:
 #endif
 
 #include "Python.h"
+#include "pycore_capsule.h"       // _PyCapsule_SetTraverse()
 #include "pycore_dict.h"          // _PyDict_Pop()
 #include "pycore_fileutils.h"     // _Py_set_inheritable()
 #include "pycore_moduleobject.h"  // _PyModule_GetState
index a1abcf683f0133f68e1b62ecfa3fdb825cdfdec4..555979dab2b7893bb1b814c1e08a51110049f3d4 100644 (file)
@@ -1,6 +1,7 @@
 /* Wrap void * pointers to be passed between C modules */
 
 #include "Python.h"
+#include "pycore_capsule.h"       // export _PyCapsule_SetTraverse()
 #include "pycore_gc.h"            // _PyObject_GC_IS_TRACKED()
 #include "pycore_object.h"        // _PyObject_GC_TRACK()
 
index bc1250f63957e277ed20ced6f4845e4d69fb9e91..9ab84702d1f2d26bcb87b836f4855c37fe09f372 100644 (file)
     <ClInclude Include="..\Include\internal\pycore_bytes_methods.h" />
     <ClInclude Include="..\Include\internal\pycore_bytesobject.h" />
     <ClInclude Include="..\Include\internal\pycore_call.h" />
+    <ClInclude Include="..\Include\internal\pycore_capsule.h" />
     <ClInclude Include="..\Include\internal\pycore_ceval.h" />
     <ClInclude Include="..\Include\internal\pycore_ceval_state.h" />
     <ClInclude Include="..\Include\internal\pycore_cfg.h" />
index a8a11d3b8b83b15ec5c35b7a68e4758c035e4950..d5c53a0c64b29c4f812e20715a1c0efa68b98ab4 100644 (file)
     <ClInclude Include="..\Include\internal\pycore_call.h">
       <Filter>Include\internal</Filter>
     </ClInclude>
+    <ClInclude Include="..\Include\internal\pycore_capsule.h">
+      <Filter>Include\internal</Filter>
+    </ClInclude>
     <ClInclude Include="..\Include\internal\pycore_ceval.h">
       <Filter>Include\internal</Filter>
     </ClInclude>