summaryrefslogtreecommitdiffstats
path: root/setup.py
diff options
context:
space:
mode:
authorPetr Viktorin <encukou@gmail.com>2020-12-08 16:36:53 (GMT)
committerGitHub <noreply@github.com>2020-12-08 16:36:53 (GMT)
commitc168b5078f88874b9acd993ac886f82269c780dd (patch)
treee4c2b04e56d9be570f7d7f33c4f8d1d0a180e6f9 /setup.py
parent4aa67853cc7d6ed4f9ebb726ceaa2c89f9feabda (diff)
downloadcpython-c168b5078f88874b9acd993ac886f82269c780dd.zip
cpython-c168b5078f88874b9acd993ac886f82269c780dd.tar.gz
cpython-c168b5078f88874b9acd993ac886f82269c780dd.tar.bz2
bpo-42111: Make the xxlimited module an example of best extension module practices (GH-23226)
- Copy existing xxlimited to xxlimited53 (named for the limited API version it uses) - Build both modules, both in debug and release - Test both modules
Diffstat (limited to 'setup.py')
-rw-r--r--setup.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/setup.py b/setup.py
index 90588e8..ca5a04d 100644
--- a/setup.py
+++ b/setup.py
@@ -1803,8 +1803,16 @@ class PyBuildExt(build_ext):
## self.add(Extension('xx', ['xxmodule.c']))
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', '0x03100000')]))
+ self.add(Extension('xxlimited_35', ['xxlimited_35.c'],
define_macros=[('Py_LIMITED_API', '0x03050000')]))
+ else:
+ # Debug mode: Build xxlimited with the full API
+ # (which is compatible with the limited one)
+ self.add(Extension('xxlimited', ['xxlimited.c']))
+ self.add(Extension('xxlimited_35', ['xxlimited_35.c']))
def detect_tkinter_explicitly(self):
# Build _tkinter using explicit locations for Tcl/Tk.