summaryrefslogtreecommitdiff
path: root/cffi/recompiler.py
diff options
context:
space:
mode:
authorArmin Rigo <arigo@tunes.org>2020-08-13 10:32:06 +0200
committerArmin Rigo <arigo@tunes.org>2020-08-13 10:32:06 +0200
commita4aa1122acec1ab59cd669cb0b3a12c7bdc76f90 (patch)
tree779cd79208c1ba53781cf23a6547b212e1323c4a /cffi/recompiler.py
parentb43cd975844bce0c361e5b3cd05bb1350de496c9 (diff)
downloadcffi-a4aa1122acec1ab59cd669cb0b3a12c7bdc76f90.tar.gz
another attempt at Py_LIMITED_API on Windows on CPython >= 3.5
Diffstat (limited to 'cffi/recompiler.py')
-rw-r--r--cffi/recompiler.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/cffi/recompiler.py b/cffi/recompiler.py
index 1309572..1aeae5b 100644
--- a/cffi/recompiler.py
+++ b/cffi/recompiler.py
@@ -7,6 +7,9 @@ VERSION_BASE = 0x2601
VERSION_EMBEDDED = 0x2701
VERSION_CHAR16CHAR32 = 0x2801
+USE_LIMITED_API = (sys.platform != 'win32' or sys.version_info < (3, 0) or
+ sys.version_info >= (3, 5))
+
class GlobalExpr:
def __init__(self, name, address, type_op, size=0, check_value=0):
@@ -283,6 +286,8 @@ class Recompiler:
prnt = self._prnt
if self.ffi._embedding is not None:
prnt('#define _CFFI_USE_EMBEDDING')
+ if not USE_LIMITED_API:
+ prnt('#define _CFFI_NO_LIMITED_API')
#
# first the '#include' (actually done by inlining the file's content)
lines = self._rel_readlines('_cffi_include.h')