[Python-checkins] bpo-41111: xxlimited.c defines Py_LIMITED_API (GH-25151)

vstinner webhook-mailer at python.org
Fri Apr 2 10:48:20 EDT 2021


https://github.com/python/cpython/commit/240bcf82a11fe7433a61da70605e924c53b88096
commit: 240bcf82a11fe7433a61da70605e924c53b88096
branch: master
author: Victor Stinner <vstinner at python.org>
committer: vstinner <vstinner at python.org>
date: 2021-04-02T16:48:11+02:00
summary:

bpo-41111: xxlimited.c defines Py_LIMITED_API (GH-25151)

xxlimited.c and xxlimited_35.c now define the Py_LIMITED_API macro,
rather than having to do it in the build recipe.

Co-authored-by: Hai Shi <shihai1992 at gmail.com>

files:
M Modules/xxlimited.c
M Modules/xxlimited_35.c
M PCbuild/xxlimited.vcxproj
M PCbuild/xxlimited_35.vcxproj
M setup.py

diff --git a/Modules/xxlimited.c b/Modules/xxlimited.c
index 883c8a9b5e183..c3d98d34eb591 100644
--- a/Modules/xxlimited.c
+++ b/Modules/xxlimited.c
@@ -55,6 +55,8 @@
           pass
    */
 
+#define Py_LIMITED_API 0x030a0000
+
 #include "Python.h"
 
 // Module state
diff --git a/Modules/xxlimited_35.c b/Modules/xxlimited_35.c
index ce96e8c90efd4..5e93854f68571 100644
--- a/Modules/xxlimited_35.c
+++ b/Modules/xxlimited_35.c
@@ -5,10 +5,12 @@
  * See the xxlimited module for an extension module template.
  */
 
-/* Xxo objects */
+#define Py_LIMITED_API 0x03050000
 
 #include "Python.h"
 
+/* Xxo objects */
+
 static PyObject *ErrorObject;
 
 typedef struct {
diff --git a/PCbuild/xxlimited.vcxproj b/PCbuild/xxlimited.vcxproj
index 61e4e5784e7ab..1c776fb0da3e7 100644
--- a/PCbuild/xxlimited.vcxproj
+++ b/PCbuild/xxlimited.vcxproj
@@ -93,9 +93,6 @@
     <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
   </PropertyGroup>
   <ItemDefinitionGroup>
-    <ClCompile>
-      <PreprocessorDefinitions>%(PreprocessorDefinitions);Py_LIMITED_API=0x030A0000</PreprocessorDefinitions>
-    </ClCompile>
     <Link>
       <AdditionalDependencies>wsock32.lib;%(AdditionalDependencies)</AdditionalDependencies>
     </Link>
diff --git a/PCbuild/xxlimited_35.vcxproj b/PCbuild/xxlimited_35.vcxproj
index 7e49eadf9037d..dd830b3b6aaa9 100644
--- a/PCbuild/xxlimited_35.vcxproj
+++ b/PCbuild/xxlimited_35.vcxproj
@@ -93,9 +93,6 @@
     <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
   </PropertyGroup>
   <ItemDefinitionGroup>
-    <ClCompile>
-      <PreprocessorDefinitions>%(PreprocessorDefinitions);Py_LIMITED_API=0x03060000</PreprocessorDefinitions>
-    </ClCompile>
     <Link>
       <AdditionalDependencies>wsock32.lib;%(AdditionalDependencies)</AdditionalDependencies>
     </Link>
diff --git a/setup.py b/setup.py
index 3b4e7ae70a4ec..edf3cb4f230b5 100644
--- a/setup.py
+++ b/setup.py
@@ -1865,10 +1865,8 @@ def detect_modules(self):
 ##         self.add(Extension('xx', ['xxmodule.c']))
 
         # Limited C API
-        self.add(Extension('xxlimited', ['xxlimited.c'],
-                           define_macros=[('Py_LIMITED_API', '0x030a0000')]))
-        self.add(Extension('xxlimited_35', ['xxlimited_35.c'],
-                           define_macros=[('Py_LIMITED_API', '0x03050000')]))
+        self.add(Extension('xxlimited', ['xxlimited.c']))
+        self.add(Extension('xxlimited_35', ['xxlimited_35.c']))
 
     def detect_tkinter_fromenv(self):
         # Build _tkinter using the Tcl/Tk locations specified by



More information about the Python-checkins mailing list