summaryrefslogtreecommitdiff
path: root/cffi/recompiler.py
diff options
context:
space:
mode:
Diffstat (limited to 'cffi/recompiler.py')
-rw-r--r--cffi/recompiler.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/cffi/recompiler.py b/cffi/recompiler.py
index 86b37d7..5d9d32d 100644
--- a/cffi/recompiler.py
+++ b/cffi/recompiler.py
@@ -407,7 +407,7 @@ class Recompiler:
prnt(' NULL, /* no includes */')
prnt(' %d, /* num_types */' % (len(self.cffi_types),))
flags = 0
- if self._num_externpy:
+ if self._num_externpy > 0 or self.ffi._embedding is not None:
flags |= 1 # set to mean that we use extern "Python"
prnt(' %d, /* flags */' % flags)
prnt('};')
@@ -422,7 +422,7 @@ class Recompiler:
prnt('PyMODINIT_FUNC')
prnt('_cffi_pypyinit_%s(const void *p[])' % (base_module_name,))
prnt('{')
- if self._num_externpy:
+ if flags & 1:
prnt(' if (((intptr_t)p[0]) >= 0x0A03) {')
prnt(' _cffi_call_python_org = '
'(void(*)(struct _cffi_externpy_s *, char *))p[1];')