Skip to content

bpo-45847: Port array, _contextvars, math, and cmath to PY_STDLIB_MOD_SIMPLE (GH-29688) #29688

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions Modules/Setup.stdlib.in
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@

############################################################################
# Modules that should always be present (POSIX and Windows):
@MODULE_ARRAY_TRUE@array arraymodule.c
@MODULE__CONTEXTVARS_TRUE@_contextvars _contextvarsmodule.c

# needs libm
@MODULE_MATH_TRUE@math mathmodule.c
@MODULE_CMATH_TRUE@cmath cmathmodule.c

# needs libm and on some platforms librt
@MODULE__DATETIME_TRUE@_datetime _datetimemodule.c
Expand Down
76 changes: 76 additions & 0 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -688,8 +688,16 @@ MODULE_OSSAUDIODEV_FALSE
MODULE_OSSAUDIODEV_TRUE
MODULE_GRP_FALSE
MODULE_GRP_TRUE
MODULE_CMATH_FALSE
MODULE_CMATH_TRUE
MODULE_MATH_FALSE
MODULE_MATH_TRUE
MODULE__DATETIME_FALSE
MODULE__DATETIME_TRUE
MODULE__CONTEXTVARS_FALSE
MODULE__CONTEXTVARS_TRUE
MODULE_ARRAY_FALSE
MODULE_ARRAY_TRUE
MODULE_TIME_FALSE
MODULE_TIME_TRUE
MODULE__IO_FALSE
Expand Down Expand Up @@ -19562,6 +19570,30 @@ fi



if true; then
MODULE_ARRAY_TRUE=
MODULE_ARRAY_FALSE='#'
else
MODULE_ARRAY_TRUE='#'
MODULE_ARRAY_FALSE=
fi





if true; then
MODULE__CONTEXTVARS_TRUE=
MODULE__CONTEXTVARS_FALSE='#'
else
MODULE__CONTEXTVARS_TRUE='#'
MODULE__CONTEXTVARS_FALSE=
fi





if true; then
MODULE__DATETIME_TRUE=
MODULE__DATETIME_FALSE='#'
Expand All @@ -19576,6 +19608,34 @@ fi



if true; then
MODULE_MATH_TRUE=
MODULE_MATH_FALSE='#'
else
MODULE_MATH_TRUE='#'
MODULE_MATH_FALSE=
fi



as_fn_append MODULE_BLOCK "MODULE_MATH_LDFLAGS=$LIBM$as_nl"



if true; then
MODULE_CMATH_TRUE=
MODULE_CMATH_FALSE='#'
else
MODULE_CMATH_TRUE='#'
MODULE_CMATH_FALSE=
fi



as_fn_append MODULE_BLOCK "MODULE_CMATH_LDFLAGS=$LIBM$as_nl"




{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdlib extension module grp" >&5
$as_echo_n "checking for stdlib extension module grp... " >&6; }
Expand Down Expand Up @@ -20741,10 +20801,26 @@ if test -z "${MODULE_TIME_TRUE}" && test -z "${MODULE_TIME_FALSE}"; then
as_fn_error $? "conditional \"MODULE_TIME\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
if test -z "${MODULE_ARRAY_TRUE}" && test -z "${MODULE_ARRAY_FALSE}"; then
as_fn_error $? "conditional \"MODULE_ARRAY\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
if test -z "${MODULE__CONTEXTVARS_TRUE}" && test -z "${MODULE__CONTEXTVARS_FALSE}"; then
as_fn_error $? "conditional \"MODULE__CONTEXTVARS\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
if test -z "${MODULE__DATETIME_TRUE}" && test -z "${MODULE__DATETIME_FALSE}"; then
as_fn_error $? "conditional \"MODULE__DATETIME\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
if test -z "${MODULE_MATH_TRUE}" && test -z "${MODULE_MATH_FALSE}"; then
as_fn_error $? "conditional \"MODULE_MATH\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
if test -z "${MODULE_CMATH_TRUE}" && test -z "${MODULE_CMATH_FALSE}"; then
as_fn_error $? "conditional \"MODULE_CMATH\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
if test -z "${MODULE_GRP_TRUE}" && test -z "${MODULE_GRP_FALSE}"; then
as_fn_error $? "conditional \"MODULE_GRP\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
Expand Down
4 changes: 4 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -6057,7 +6057,11 @@ PY_STDLIB_MOD_SIMPLE([_io], [-I\$(srcdir)/Modules/_io], [])
PY_STDLIB_MOD_SIMPLE([time], [], [$TIMEMODULE_LIB])

dnl always enabled extension modules
PY_STDLIB_MOD_SIMPLE([array])
PY_STDLIB_MOD_SIMPLE([_contextvars])
PY_STDLIB_MOD_SIMPLE([_datetime], [], [$TIMEMODULE_LIB $LIBM])
PY_STDLIB_MOD_SIMPLE([math], [], [$LIBM])
PY_STDLIB_MOD_SIMPLE([cmath], [], [$LIBM])

dnl platform specific extensions
PY_STDLIB_MOD([grp], [], [test "$ac_cv_func_getgrgid" = yes -o "$ac_cv_func_getgrgid_r" = yes])
Expand Down
10 changes: 4 additions & 6 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -984,18 +984,16 @@ def detect_simple_extensions(self):
#

# array objects
self.add(Extension('array', ['arraymodule.c']))
self.addext(Extension('array', ['arraymodule.c']))

# Context Variables
self.add(Extension('_contextvars', ['_contextvarsmodule.c']))
self.addext(Extension('_contextvars', ['_contextvarsmodule.c']))

# math library functions, e.g. sin()
self.add(Extension('math', ['mathmodule.c'],
libraries=['m']))
self.addext(Extension('math', ['mathmodule.c']))

# complex math library functions
self.add(Extension('cmath', ['cmathmodule.c'],
libraries=['m']))
self.addext(Extension('cmath', ['cmathmodule.c']))

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