diff options
author | Armin Rigo <arigo@tunes.org> | 2022-02-05 06:24:53 +0100 |
---|---|---|
committer | Armin Rigo <arigo@tunes.org> | 2022-02-05 06:24:53 +0100 |
commit | 31ea07e6c407b986262a668cead0450be7daab1d (patch) | |
tree | 98d180ab1e0b071e1605afdce1d0f9be30707783 | |
parent | b8192a4bffeacb872a9695b3aa8e9ec9d426407f (diff) | |
download | cffi-31ea07e6c407b986262a668cead0450be7daab1d.tar.gz |
oops, fix for a regression introduced in 216d8676b652
seen in test_recompiler
-rw-r--r-- | cffi/recompiler.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/cffi/recompiler.py b/cffi/recompiler.py index 16a7078..5d9d32d 100644 --- a/cffi/recompiler.py +++ b/cffi/recompiler.py @@ -406,8 +406,9 @@ class Recompiler: else: prnt(' NULL, /* no includes */') prnt(' %d, /* num_types */' % (len(self.cffi_types),)) - # set 'flags' to 1 in embedding mode, 0 otherwise - flags = int(self.ffi._embedding is not None) + flags = 0 + 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('};') prnt() @@ -421,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];') |