summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Include/internal/pycore_capsule.h17
-rw-r--r--Include/pycapsule.h5
-rw-r--r--Makefile.pre.in1
-rw-r--r--Modules/socketmodule.c1
-rw-r--r--Objects/capsule.c1
-rw-r--r--PCbuild/pythoncore.vcxproj1
-rw-r--r--PCbuild/pythoncore.vcxproj.filters3
7 files changed, 24 insertions, 5 deletions
diff --git a/Include/internal/pycore_capsule.h b/Include/internal/pycore_capsule.h
new file mode 100644
index 0000000..aa2c67f
--- /dev/null
+++ b/Include/internal/pycore_capsule.h
@@ -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 */
diff --git a/Include/pycapsule.h b/Include/pycapsule.h
index 8660e83..666b9f8 100644
--- a/Include/pycapsule.h
+++ b/Include/pycapsule.h
@@ -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
diff --git a/Makefile.pre.in b/Makefile.pre.in
index 62a55bb..310caa9 100644
--- a/Makefile.pre.in
+++ b/Makefile.pre.in
@@ -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 \
diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c
index 8cc45e2..e368185 100644
--- a/Modules/socketmodule.c
+++ b/Modules/socketmodule.c
@@ -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
diff --git a/Objects/capsule.c b/Objects/capsule.c
index a1abcf6..555979d 100644
--- a/Objects/capsule.c
+++ b/Objects/capsule.c
@@ -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()
diff --git a/PCbuild/pythoncore.vcxproj b/PCbuild/pythoncore.vcxproj
index bc1250f..9ab8470 100644
--- a/PCbuild/pythoncore.vcxproj
+++ b/PCbuild/pythoncore.vcxproj
@@ -206,6 +206,7 @@
<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" />
diff --git a/PCbuild/pythoncore.vcxproj.filters b/PCbuild/pythoncore.vcxproj.filters
index a8a11d3..d5c53a0 100644
--- a/PCbuild/pythoncore.vcxproj.filters
+++ b/PCbuild/pythoncore.vcxproj.filters
@@ -528,6 +528,9 @@
<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>