Skip to content

Commit 133c65a

Browse files
author
Erlend Egeberg Aasland
authored
bpo-45847: Port array, _contextvars, math, and cmath to PY_STDLIB_MOD_SIMPLE (GH-29688)
1 parent db2277a commit 133c65a

File tree

4 files changed

+90
-6
lines changed

4 files changed

+90
-6
lines changed

Modules/Setup.stdlib.in

+6
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,12 @@
2828

2929
############################################################################
3030
# Modules that should always be present (POSIX and Windows):
31+
@MODULE_ARRAY_TRUE@array arraymodule.c
32+
@MODULE__CONTEXTVARS_TRUE@_contextvars _contextvarsmodule.c
33+
34+
# needs libm
35+
@MODULE_MATH_TRUE@math mathmodule.c
36+
@MODULE_CMATH_TRUE@cmath cmathmodule.c
3137

3238
# needs libm and on some platforms librt
3339
@MODULE__DATETIME_TRUE@_datetime _datetimemodule.c

configure

+76
Original file line numberDiff line numberDiff line change
@@ -688,8 +688,16 @@ MODULE_OSSAUDIODEV_FALSE
688688
MODULE_OSSAUDIODEV_TRUE
689689
MODULE_GRP_FALSE
690690
MODULE_GRP_TRUE
691+
MODULE_CMATH_FALSE
692+
MODULE_CMATH_TRUE
693+
MODULE_MATH_FALSE
694+
MODULE_MATH_TRUE
691695
MODULE__DATETIME_FALSE
692696
MODULE__DATETIME_TRUE
697+
MODULE__CONTEXTVARS_FALSE
698+
MODULE__CONTEXTVARS_TRUE
699+
MODULE_ARRAY_FALSE
700+
MODULE_ARRAY_TRUE
693701
MODULE_TIME_FALSE
694702
MODULE_TIME_TRUE
695703
MODULE__IO_FALSE
@@ -19566,6 +19574,30 @@ fi
1956619574

1956719575

1956819576

19577+
if true; then
19578+
MODULE_ARRAY_TRUE=
19579+
MODULE_ARRAY_FALSE='#'
19580+
else
19581+
MODULE_ARRAY_TRUE='#'
19582+
MODULE_ARRAY_FALSE=
19583+
fi
19584+
19585+
19586+
19587+
19588+
19589+
if true; then
19590+
MODULE__CONTEXTVARS_TRUE=
19591+
MODULE__CONTEXTVARS_FALSE='#'
19592+
else
19593+
MODULE__CONTEXTVARS_TRUE='#'
19594+
MODULE__CONTEXTVARS_FALSE=
19595+
fi
19596+
19597+
19598+
19599+
19600+
1956919601
if true; then
1957019602
MODULE__DATETIME_TRUE=
1957119603
MODULE__DATETIME_FALSE='#'
@@ -19580,6 +19612,34 @@ fi
1958019612

1958119613

1958219614

19615+
if true; then
19616+
MODULE_MATH_TRUE=
19617+
MODULE_MATH_FALSE='#'
19618+
else
19619+
MODULE_MATH_TRUE='#'
19620+
MODULE_MATH_FALSE=
19621+
fi
19622+
19623+
19624+
19625+
as_fn_append MODULE_BLOCK "MODULE_MATH_LDFLAGS=$LIBM$as_nl"
19626+
19627+
19628+
19629+
if true; then
19630+
MODULE_CMATH_TRUE=
19631+
MODULE_CMATH_FALSE='#'
19632+
else
19633+
MODULE_CMATH_TRUE='#'
19634+
MODULE_CMATH_FALSE=
19635+
fi
19636+
19637+
19638+
19639+
as_fn_append MODULE_BLOCK "MODULE_CMATH_LDFLAGS=$LIBM$as_nl"
19640+
19641+
19642+
1958319643

1958419644
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdlib extension module grp" >&5
1958519645
$as_echo_n "checking for stdlib extension module grp... " >&6; }
@@ -20745,10 +20805,26 @@ if test -z "${MODULE_TIME_TRUE}" && test -z "${MODULE_TIME_FALSE}"; then
2074520805
as_fn_error $? "conditional \"MODULE_TIME\" was never defined.
2074620806
Usually this means the macro was only invoked conditionally." "$LINENO" 5
2074720807
fi
20808+
if test -z "${MODULE_ARRAY_TRUE}" && test -z "${MODULE_ARRAY_FALSE}"; then
20809+
as_fn_error $? "conditional \"MODULE_ARRAY\" was never defined.
20810+
Usually this means the macro was only invoked conditionally." "$LINENO" 5
20811+
fi
20812+
if test -z "${MODULE__CONTEXTVARS_TRUE}" && test -z "${MODULE__CONTEXTVARS_FALSE}"; then
20813+
as_fn_error $? "conditional \"MODULE__CONTEXTVARS\" was never defined.
20814+
Usually this means the macro was only invoked conditionally." "$LINENO" 5
20815+
fi
2074820816
if test -z "${MODULE__DATETIME_TRUE}" && test -z "${MODULE__DATETIME_FALSE}"; then
2074920817
as_fn_error $? "conditional \"MODULE__DATETIME\" was never defined.
2075020818
Usually this means the macro was only invoked conditionally." "$LINENO" 5
2075120819
fi
20820+
if test -z "${MODULE_MATH_TRUE}" && test -z "${MODULE_MATH_FALSE}"; then
20821+
as_fn_error $? "conditional \"MODULE_MATH\" was never defined.
20822+
Usually this means the macro was only invoked conditionally." "$LINENO" 5
20823+
fi
20824+
if test -z "${MODULE_CMATH_TRUE}" && test -z "${MODULE_CMATH_FALSE}"; then
20825+
as_fn_error $? "conditional \"MODULE_CMATH\" was never defined.
20826+
Usually this means the macro was only invoked conditionally." "$LINENO" 5
20827+
fi
2075220828
if test -z "${MODULE_GRP_TRUE}" && test -z "${MODULE_GRP_FALSE}"; then
2075320829
as_fn_error $? "conditional \"MODULE_GRP\" was never defined.
2075420830
Usually this means the macro was only invoked conditionally." "$LINENO" 5

configure.ac

+4
Original file line numberDiff line numberDiff line change
@@ -6075,7 +6075,11 @@ PY_STDLIB_MOD_SIMPLE([_io], [-I\$(srcdir)/Modules/_io], [])
60756075
PY_STDLIB_MOD_SIMPLE([time], [], [$TIMEMODULE_LIB])
60766076

60776077
dnl always enabled extension modules
6078+
PY_STDLIB_MOD_SIMPLE([array])
6079+
PY_STDLIB_MOD_SIMPLE([_contextvars])
60786080
PY_STDLIB_MOD_SIMPLE([_datetime], [], [$TIMEMODULE_LIB $LIBM])
6081+
PY_STDLIB_MOD_SIMPLE([math], [], [$LIBM])
6082+
PY_STDLIB_MOD_SIMPLE([cmath], [], [$LIBM])
60796083

60806084
dnl platform specific extensions
60816085
PY_STDLIB_MOD([grp], [], [test "$ac_cv_func_getgrgid" = yes -o "$ac_cv_func_getgrgid_r" = yes])

setup.py

+4-6
Original file line numberDiff line numberDiff line change
@@ -984,18 +984,16 @@ def detect_simple_extensions(self):
984984
#
985985

986986
# array objects
987-
self.add(Extension('array', ['arraymodule.c']))
987+
self.addext(Extension('array', ['arraymodule.c']))
988988

989989
# Context Variables
990-
self.add(Extension('_contextvars', ['_contextvarsmodule.c']))
990+
self.addext(Extension('_contextvars', ['_contextvarsmodule.c']))
991991

992992
# math library functions, e.g. sin()
993-
self.add(Extension('math', ['mathmodule.c'],
994-
libraries=['m']))
993+
self.addext(Extension('math', ['mathmodule.c']))
995994

996995
# complex math library functions
997-
self.add(Extension('cmath', ['cmathmodule.c'],
998-
libraries=['m']))
996+
self.addext(Extension('cmath', ['cmathmodule.c']))
999997

1000998
# time libraries: librt may be needed for clock_gettime()
1001999
time_libs = []

0 commit comments

Comments
 (0)