From 718cee08cc082ece590f5a012253a405422da03d Mon Sep 17 00:00:00 2001 From: Erlend Egeberg Aasland Date: Mon, 22 Nov 2021 09:45:41 +0100 Subject: bpo-45847: Port _bisect, _heapq, _json, _pickle, _random, and _zoneinfo to PY_STDLIB_MOD_SIMPLE (GH-29689) Automerge-Triggered-By: GH:tiran --- Modules/Setup.stdlib.in | 6 +++ configure | 126 ++++++++++++++++++++++++++++++++++++++++++++---- configure.ac | 8 ++- setup.py | 15 +++--- 4 files changed, 136 insertions(+), 19 deletions(-) diff --git a/Modules/Setup.stdlib.in b/Modules/Setup.stdlib.in index b22a956..bf41441 100644 --- a/Modules/Setup.stdlib.in +++ b/Modules/Setup.stdlib.in @@ -29,7 +29,13 @@ ############################################################################ # Modules that should always be present (POSIX and Windows): @MODULE_ARRAY_TRUE@array arraymodule.c +@MODULE__BISECT_TRUE@_bisect _bisectmodule.c @MODULE__CONTEXTVARS_TRUE@_contextvars _contextvarsmodule.c +@MODULE__HEAPQ_TRUE@_heapq _heapqmodule.c +@MODULE__JSON_TRUE@_json _json.c +@MODULE__PICKLE_TRUE@_pickle _pickle.c +@MODULE__RANDOM_TRUE@_random _randommodule.c +@MODULE__ZONEINFO_TRUE@_zoneinfo _zoneinfo.c # needs libm @MODULE_MATH_TRUE@math mathmodule.c diff --git a/configure b/configure index 72285a6..6aea5b6 100755 --- a/configure +++ b/configure @@ -688,14 +688,26 @@ MODULE_OSSAUDIODEV_FALSE MODULE_OSSAUDIODEV_TRUE MODULE_GRP_FALSE MODULE_GRP_TRUE -MODULE_CMATH_FALSE -MODULE_CMATH_TRUE +MODULE__ZONEINFO_FALSE +MODULE__ZONEINFO_TRUE +MODULE__RANDOM_FALSE +MODULE__RANDOM_TRUE +MODULE__PICKLE_FALSE +MODULE__PICKLE_TRUE MODULE_MATH_FALSE MODULE_MATH_TRUE +MODULE__JSON_FALSE +MODULE__JSON_TRUE +MODULE__HEAPQ_FALSE +MODULE__HEAPQ_TRUE MODULE__DATETIME_FALSE MODULE__DATETIME_TRUE MODULE__CONTEXTVARS_FALSE MODULE__CONTEXTVARS_TRUE +MODULE_CMATH_FALSE +MODULE_CMATH_TRUE +MODULE__BISECT_FALSE +MODULE__BISECT_TRUE MODULE_ARRAY_FALSE MODULE_ARRAY_TRUE MODULE_TIME_FALSE @@ -19587,6 +19599,32 @@ fi if true; then + MODULE__BISECT_TRUE= + MODULE__BISECT_FALSE='#' +else + MODULE__BISECT_TRUE='#' + MODULE__BISECT_FALSE= +fi + + + + + + 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" + + + + if true; then MODULE__CONTEXTVARS_TRUE= MODULE__CONTEXTVARS_FALSE='#' else @@ -19613,6 +19651,30 @@ fi if true; then + MODULE__HEAPQ_TRUE= + MODULE__HEAPQ_FALSE='#' +else + MODULE__HEAPQ_TRUE='#' + MODULE__HEAPQ_FALSE= +fi + + + + + + if true; then + MODULE__JSON_TRUE= + MODULE__JSON_FALSE='#' +else + MODULE__JSON_TRUE='#' + MODULE__JSON_FALSE= +fi + + + + + + if true; then MODULE_MATH_TRUE= MODULE_MATH_FALSE='#' else @@ -19627,16 +19689,38 @@ fi if true; then - MODULE_CMATH_TRUE= - MODULE_CMATH_FALSE='#' + MODULE__PICKLE_TRUE= + MODULE__PICKLE_FALSE='#' else - MODULE_CMATH_TRUE='#' - MODULE_CMATH_FALSE= + MODULE__PICKLE_TRUE='#' + MODULE__PICKLE_FALSE= fi - as_fn_append MODULE_BLOCK "MODULE_CMATH_LDFLAGS=$LIBM$as_nl" + + + if true; then + MODULE__RANDOM_TRUE= + MODULE__RANDOM_FALSE='#' +else + MODULE__RANDOM_TRUE='#' + MODULE__RANDOM_FALSE= +fi + + + + + + if true; then + MODULE__ZONEINFO_TRUE= + MODULE__ZONEINFO_FALSE='#' +else + MODULE__ZONEINFO_TRUE='#' + MODULE__ZONEINFO_FALSE= +fi + + @@ -20809,6 +20893,14 @@ 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__BISECT_TRUE}" && test -z "${MODULE__BISECT_FALSE}"; then + as_fn_error $? "conditional \"MODULE__BISECT\" 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__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 @@ -20817,12 +20909,28 @@ if test -z "${MODULE__DATETIME_TRUE}" && test -z "${MODULE__DATETIME_FALSE}"; th 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__HEAPQ_TRUE}" && test -z "${MODULE__HEAPQ_FALSE}"; then + as_fn_error $? "conditional \"MODULE__HEAPQ\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${MODULE__JSON_TRUE}" && test -z "${MODULE__JSON_FALSE}"; then + as_fn_error $? "conditional \"MODULE__JSON\" 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. +if test -z "${MODULE__PICKLE_TRUE}" && test -z "${MODULE__PICKLE_FALSE}"; then + as_fn_error $? "conditional \"MODULE__PICKLE\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${MODULE__RANDOM_TRUE}" && test -z "${MODULE__RANDOM_FALSE}"; then + as_fn_error $? "conditional \"MODULE__RANDOM\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${MODULE__ZONEINFO_TRUE}" && test -z "${MODULE__ZONEINFO_FALSE}"; then + as_fn_error $? "conditional \"MODULE__ZONEINFO\" 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 diff --git a/configure.ac b/configure.ac index e0013c7..925d7f9 100644 --- a/configure.ac +++ b/configure.ac @@ -6076,10 +6076,16 @@ PY_STDLIB_MOD_SIMPLE([time], [], [$TIMEMODULE_LIB]) dnl always enabled extension modules PY_STDLIB_MOD_SIMPLE([array]) +PY_STDLIB_MOD_SIMPLE([_bisect]) +PY_STDLIB_MOD_SIMPLE([cmath], [], [$LIBM]) PY_STDLIB_MOD_SIMPLE([_contextvars]) PY_STDLIB_MOD_SIMPLE([_datetime], [], [$TIMEMODULE_LIB $LIBM]) +PY_STDLIB_MOD_SIMPLE([_heapq]) +PY_STDLIB_MOD_SIMPLE([_json]) PY_STDLIB_MOD_SIMPLE([math], [], [$LIBM]) -PY_STDLIB_MOD_SIMPLE([cmath], [], [$LIBM]) +PY_STDLIB_MOD_SIMPLE([_pickle]) +PY_STDLIB_MOD_SIMPLE([_random]) +PY_STDLIB_MOD_SIMPLE([_zoneinfo]) dnl platform specific extensions PY_STDLIB_MOD([grp], [], [test "$ac_cv_func_getgrgid" = yes -o "$ac_cv_func_getgrgid_r" = yes]) diff --git a/setup.py b/setup.py index b2a3f4e..a76df82 100644 --- a/setup.py +++ b/setup.py @@ -1004,18 +1004,15 @@ class PyBuildExt(build_ext): # libm is needed by delta_new() that uses round() and by accum() that # uses modf(). self.addext(Extension('_datetime', ['_datetimemodule.c'])) - # zoneinfo module - self.add(Extension('_zoneinfo', ['_zoneinfo.c'])) + self.addext(Extension('_zoneinfo', ['_zoneinfo.c'])) # random number generator implemented in C - self.add(Extension("_random", ["_randommodule.c"])) - # bisect - self.add(Extension("_bisect", ["_bisectmodule.c"])) - # heapq - self.add(Extension("_heapq", ["_heapqmodule.c"])) + self.addext(Extension("_random", ["_randommodule.c"])) + self.addext(Extension("_bisect", ["_bisectmodule.c"])) + self.addext(Extension("_heapq", ["_heapqmodule.c"])) # C-optimized pickle replacement - self.add(Extension("_pickle", ["_pickle.c"])) + self.addext(Extension("_pickle", ["_pickle.c"])) # _json speedups - self.add(Extension("_json", ["_json.c"])) + self.addext(Extension("_json", ["_json.c"])) # profiler (_lsprof is for cProfile.py) self.add(Extension('_lsprof', ['_lsprof.c', 'rotatingtree.c'])) -- cgit v0.12