summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew V. Jones <andrew.jones@vector.com>2021-04-08 15:05:09 +0100
committerStefan Behnel <stefan_ml@behnel.de>2021-04-14 14:12:05 +0200
commit315c20ef3dd6006df6e61693650d183720798002 (patch)
treec415c2b07e06ce7cb715102463557ddb70e0ac94
parentc0d5282d5100975311f77895297f9e069d7075a0 (diff)
downloadcython-315c20ef3dd6006df6e61693650d183720798002.tar.gz
Only #define PY_SSIZE_T_CLEAN if it is not already #defined
Signed-off-by: Andrew V. Jones <andrew.jones@vector.com>
-rw-r--r--Cython/Compiler/ModuleNode.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/Cython/Compiler/ModuleNode.py b/Cython/Compiler/ModuleNode.py
index 3f0956dd6..fa896e619 100644
--- a/Cython/Compiler/ModuleNode.py
+++ b/Cython/Compiler/ModuleNode.py
@@ -634,7 +634,10 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
code.putln(json.dumps(metadata, indent=4, sort_keys=True))
code.putln("END: Cython Metadata */")
code.putln("")
+
+ code.putln("#ifndef PY_SSIZE_T_CLEAN")
code.putln("#define PY_SSIZE_T_CLEAN")
+ code.putln("#endif /* PY_SSIZE_T_CLEAN */")
for inc in sorted(env.c_includes.values(), key=IncludeCode.sortkey):
if inc.location == inc.INITIAL: