summaryrefslogtreecommitdiff
path: root/Lib
diff options
context:
space:
mode:
authorbenjamin-sch <Benjamin.Schiller@vector.de>2022-02-08 09:04:18 +0100
committerbenjamin-sch <Benjamin.Schiller@vector.com>2022-02-08 09:09:17 +0100
commita2992fe42e0a462dc9c08bbffa29c6b4fdbd07ff (patch)
treed86937759eb809c396fd92c41ff65484cd3b6de2 /Lib
parenta9f76c89ec0f4b2b60f2edc3d705c14cc6aec5f6 (diff)
downloadswig-a2992fe42e0a462dc9c08bbffa29c6b4fdbd07ff.tar.gz
always get the type_pointer from capsule instead of using a static variable
as the value may change after re-initilization/due to subinterpreters
Diffstat (limited to 'Lib')
-rw-r--r--Lib/python/pyrun.swg14
1 files changed, 7 insertions, 7 deletions
diff --git a/Lib/python/pyrun.swg b/Lib/python/pyrun.swg
index d42dc0f0f..2aef3ad0f 100644
--- a/Lib/python/pyrun.swg
+++ b/Lib/python/pyrun.swg
@@ -1627,19 +1627,19 @@ SWIG_Python_TypeCache(void) {
SWIGRUNTIME swig_module_info *
SWIG_Python_GetModule(void *SWIGUNUSEDPARM(clientdata)) {
+#ifdef SWIG_LINK_RUNTIME
static void *type_pointer = (void *)0;
/* first check if module already created */
if (!type_pointer) {
-#ifdef SWIG_LINK_RUNTIME
type_pointer = SWIG_ReturnGlobalTypeList((void *)0);
+ }
#else
- type_pointer = PyCapsule_Import(SWIGPY_CAPSULE_NAME, 0);
- if (PyErr_Occurred()) {
- PyErr_Clear();
- type_pointer = (void *)0;
- }
-#endif
+ void *type_pointer = PyCapsule_Import(SWIGPY_CAPSULE_NAME, 0);
+ if (PyErr_Occurred()) {
+ PyErr_Clear();
+ type_pointer = (void *)0;
}
+#endif
return (swig_module_info *) type_pointer;
}