Skip to content

Commit 2dc7d3d

Browse files
author
Erlend Egeberg Aasland
authored
bpo-45847: Port xxlimited and xxlimited_35 to PY_STDLIB_MOD (GH-29707)
1 parent 1037ca5 commit 2dc7d3d

File tree

4 files changed

+99
-6
lines changed

4 files changed

+99
-6
lines changed

Modules/Setup.stdlib.in

+5
Original file line numberDiff line numberDiff line change
@@ -135,9 +135,14 @@
135135
@MODULE__TESTBUFFER_TRUE@_testbuffer _testbuffer.c
136136
@MODULE__TESTINTERNALCAPI_TRUE@_testinternalcapi _testinternalcapi.c
137137

138+
138139
# Some testing modules MUST be built as shared libraries.
139140
*shared*
140141
@MODULE__TESTCAPI_TRUE@_testcapi _testcapimodule.c
141142
@MODULE__TESTIMPORTMULTIPLE_TRUE@_testimportmultiple _testimportmultiple.c
142143
@MODULE__TESTMULTIPHASE_TRUE@_testmultiphase _testmultiphase.c
143144
@MODULE__CTYPES_TEST_TRUE@_ctypes_test _ctypes/_ctypes_test.c
145+
146+
# Limited API template modules; must be built as shared modules.
147+
@MODULE_XXLIMITED_TRUE@xxlimited xxlimited.c
148+
@MODULE_XXLIMITED_35_TRUE@xxlimited_35 xxlimited_35.c

configure

+85
Original file line numberDiff line numberDiff line change
@@ -624,6 +624,10 @@ ac_includes_default="\
624624

625625
ac_subst_vars='LTLIBOBJS
626626
MODULE_BLOCK
627+
MODULE_XXLIMITED_35_FALSE
628+
MODULE_XXLIMITED_35_TRUE
629+
MODULE_XXLIMITED_FALSE
630+
MODULE_XXLIMITED_TRUE
627631
MODULE__CTYPES_TEST_FALSE
628632
MODULE__CTYPES_TEST_TRUE
629633
MODULE__XXTESTFUZZ_FALSE
@@ -21838,6 +21842,79 @@ fi
2183821842
$as_echo "$py_cv_module__ctypes_test" >&6; }
2183921843

2184021844

21845+
21846+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdlib extension module xxlimited" >&5
21847+
$as_echo_n "checking for stdlib extension module xxlimited... " >&6; }
21848+
case $py_stdlib_not_available in #(
21849+
*xxlimited*) :
21850+
py_cv_module_xxlimited=n/a ;; #(
21851+
*) :
21852+
if test "$Py_TRACE_REFS" = no; then :
21853+
if true; then :
21854+
py_cv_module_xxlimited=yes
21855+
else
21856+
py_cv_module_xxlimited=missing
21857+
fi
21858+
else
21859+
py_cv_module_xxlimited=disabled
21860+
fi
21861+
;;
21862+
esac
21863+
as_fn_append MODULE_BLOCK "MODULE_XXLIMITED=$py_cv_module_xxlimited$as_nl"
21864+
if test "x$py_cv_module_xxlimited" = xyes; then :
21865+
21866+
21867+
21868+
21869+
fi
21870+
if test "$py_cv_module_xxlimited" = yes; then
21871+
MODULE_XXLIMITED_TRUE=
21872+
MODULE_XXLIMITED_FALSE='#'
21873+
else
21874+
MODULE_XXLIMITED_TRUE='#'
21875+
MODULE_XXLIMITED_FALSE=
21876+
fi
21877+
21878+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $py_cv_module_xxlimited" >&5
21879+
$as_echo "$py_cv_module_xxlimited" >&6; }
21880+
21881+
21882+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdlib extension module xxlimited_35" >&5
21883+
$as_echo_n "checking for stdlib extension module xxlimited_35... " >&6; }
21884+
case $py_stdlib_not_available in #(
21885+
*xxlimited_35*) :
21886+
py_cv_module_xxlimited_35=n/a ;; #(
21887+
*) :
21888+
if test "$Py_TRACE_REFS" = no; then :
21889+
if true; then :
21890+
py_cv_module_xxlimited_35=yes
21891+
else
21892+
py_cv_module_xxlimited_35=missing
21893+
fi
21894+
else
21895+
py_cv_module_xxlimited_35=disabled
21896+
fi
21897+
;;
21898+
esac
21899+
as_fn_append MODULE_BLOCK "MODULE_XXLIMITED_35=$py_cv_module_xxlimited_35$as_nl"
21900+
if test "x$py_cv_module_xxlimited_35" = xyes; then :
21901+
21902+
21903+
21904+
21905+
fi
21906+
if test "$py_cv_module_xxlimited_35" = yes; then
21907+
MODULE_XXLIMITED_35_TRUE=
21908+
MODULE_XXLIMITED_35_FALSE='#'
21909+
else
21910+
MODULE_XXLIMITED_35_TRUE='#'
21911+
MODULE_XXLIMITED_35_FALSE=
21912+
fi
21913+
21914+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $py_cv_module_xxlimited_35" >&5
21915+
$as_echo "$py_cv_module_xxlimited_35" >&6; }
21916+
21917+
2184121918
# substitute multiline block, must come after last PY_STDLIB_MOD()
2184221919

2184321920

@@ -22214,6 +22291,14 @@ if test -z "${MODULE__CTYPES_TEST_TRUE}" && test -z "${MODULE__CTYPES_TEST_FALSE
2221422291
as_fn_error $? "conditional \"MODULE__CTYPES_TEST\" was never defined.
2221522292
Usually this means the macro was only invoked conditionally." "$LINENO" 5
2221622293
fi
22294+
if test -z "${MODULE_XXLIMITED_TRUE}" && test -z "${MODULE_XXLIMITED_FALSE}"; then
22295+
as_fn_error $? "conditional \"MODULE_XXLIMITED\" was never defined.
22296+
Usually this means the macro was only invoked conditionally." "$LINENO" 5
22297+
fi
22298+
if test -z "${MODULE_XXLIMITED_35_TRUE}" && test -z "${MODULE_XXLIMITED_35_FALSE}"; then
22299+
as_fn_error $? "conditional \"MODULE_XXLIMITED_35\" was never defined.
22300+
Usually this means the macro was only invoked conditionally." "$LINENO" 5
22301+
fi
2221722302

2221822303
: "${CONFIG_STATUS=./config.status}"
2221922304
ac_write_fail=0

configure.ac

+5
Original file line numberDiff line numberDiff line change
@@ -6219,6 +6219,11 @@ PY_STDLIB_MOD([_testmultiphase], [test "$TEST_MODULES" = yes])
62196219
PY_STDLIB_MOD([_xxtestfuzz], [test "$TEST_MODULES" = yes])
62206220
PY_STDLIB_MOD([_ctypes_test], [test "$TEST_MODULES" = yes], [], [], [-lm])
62216221

6222+
dnl Limited API template modules.
6223+
dnl The limited C API is not compatible with the Py_TRACE_REFS macro.
6224+
PY_STDLIB_MOD([xxlimited], [test "$Py_TRACE_REFS" = no])
6225+
PY_STDLIB_MOD([xxlimited_35], [test "$Py_TRACE_REFS" = no])
6226+
62226227
# substitute multiline block, must come after last PY_STDLIB_MOD()
62236228
AC_SUBST([MODULE_BLOCK])
62246229

setup.py

+4-6
Original file line numberDiff line numberDiff line change
@@ -1477,13 +1477,11 @@ def detect_modules(self):
14771477
self.missing.append('_tkinter')
14781478
self.detect_uuid()
14791479

1480-
## # Uncomment these lines if you want to play with xxmodule.c
1481-
## self.add(Extension('xx', ['xxmodule.c']))
1480+
# Uncomment the next line if you want to play with xxmodule.c
1481+
# self.add(Extension('xx', ['xxmodule.c']))
14821482

1483-
# The limited C API is not compatible with the Py_TRACE_REFS macro.
1484-
if not sysconfig.get_config_var('Py_TRACE_REFS'):
1485-
self.add(Extension('xxlimited', ['xxlimited.c']))
1486-
self.add(Extension('xxlimited_35', ['xxlimited_35.c']))
1483+
self.addext(Extension('xxlimited', ['xxlimited.c']))
1484+
self.addext(Extension('xxlimited_35', ['xxlimited_35.c']))
14871485

14881486
def detect_tkinter_fromenv(self):
14891487
# Build _tkinter using the Tcl/Tk locations specified by

0 commit comments

Comments
 (0)