diff --git a/Modules/xxlimited.c b/Modules/xxlimited.c index 883c8a9b5e1833..1ba690d9bc25ef 100644 --- a/Modules/xxlimited.c +++ b/Modules/xxlimited.c @@ -55,6 +55,10 @@ pass */ +/* xxlimited with the limited API. */ +#ifdef WITH_Py_LIMITED_API +# define Py_LIMITED_API 0x030a0000 +#endif #include "Python.h" // Module state diff --git a/Modules/xxlimited_35.c b/Modules/xxlimited_35.c index ce96e8c90efd47..10fbdfa04e7f48 100644 --- a/Modules/xxlimited_35.c +++ b/Modules/xxlimited_35.c @@ -7,6 +7,10 @@ /* Xxo objects */ +/* xxlimited_35 with the limited API. */ +#ifdef WITH_Py_LIMITED_API +# define Py_LIMITED_API 0x03050000 +#endif #include "Python.h" static PyObject *ErrorObject; diff --git a/PCbuild/xxlimited.vcxproj b/PCbuild/xxlimited.vcxproj index 61e4e5784e7abe..405dae27d8afa0 100644 --- a/PCbuild/xxlimited.vcxproj +++ b/PCbuild/xxlimited.vcxproj @@ -94,7 +94,7 @@ - %(PreprocessorDefinitions);Py_LIMITED_API=0x030A0000 + %(PreprocessorDefinitions);WITH_Py_LIMITED_API=1 wsock32.lib;%(AdditionalDependencies) diff --git a/PCbuild/xxlimited_35.vcxproj b/PCbuild/xxlimited_35.vcxproj index 7e49eadf9037da..ad8a6d95b63b00 100644 --- a/PCbuild/xxlimited_35.vcxproj +++ b/PCbuild/xxlimited_35.vcxproj @@ -94,7 +94,7 @@ - %(PreprocessorDefinitions);Py_LIMITED_API=0x03060000 + %(PreprocessorDefinitions);WITH_Py_LIMITED_API=1 wsock32.lib;%(AdditionalDependencies) diff --git a/setup.py b/setup.py index 75bd16375063a0..3ed34da1e8e50f 100644 --- a/setup.py +++ b/setup.py @@ -1867,9 +1867,9 @@ def detect_modules(self): if 'd' not in sysconfig.get_config_var('ABIFLAGS'): # Non-debug mode: Build xxlimited with limited API self.add(Extension('xxlimited', ['xxlimited.c'], - define_macros=[('Py_LIMITED_API', '0x030a0000')])) + define_macros=[('WITH_Py_LIMITED_API', 1)])) self.add(Extension('xxlimited_35', ['xxlimited_35.c'], - define_macros=[('Py_LIMITED_API', '0x03050000')])) + define_macros=[('WITH_Py_LIMITED_API', 1)])) else: # Debug mode: Build xxlimited with the full API # (which is compatible with the limited one)