From 9f5cc45dfac688ce6f68f5ab6a6ed9c613593087 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Mon, 10 Nov 2025 16:42:06 +0100 Subject: [PATCH 01/12] gh-140824: Implement the math package in Python Rename the 'math' extension to '_math'. --- Lib/math/__init__.py | 19 +++++++++++++++++++ Lib/math/integer.py | 5 +++++ Lib/test/test_math.py | 18 ++++++++++++++++++ Modules/Setup | 2 +- Modules/Setup.stdlib.in | 2 +- Modules/mathmodule.c | 31 ++----------------------------- configure | 28 ++++++++++++++-------------- configure.ac | 2 +- 8 files changed, 61 insertions(+), 46 deletions(-) create mode 100644 Lib/math/__init__.py create mode 100644 Lib/math/integer.py diff --git a/Lib/math/__init__.py b/Lib/math/__init__.py new file mode 100644 index 00000000000000..bb37649a433773 --- /dev/null +++ b/Lib/math/__init__.py @@ -0,0 +1,19 @@ +""" +math module -- Mathematical functions +""" + +from _math import * + +# gh-140824: Fix module name for pickle +def patch_module(objs, module): + for obj in objs: + if not hasattr(obj, "__module__"): + continue + obj.__module__ = module +patch_module([obj for name, obj in globals().items() + if not name.startswith('_')], 'math') + +from _math_integer import comb, factorial, gcd, isqrt, lcm, perm +patch_module([comb, factorial, gcd, isqrt, lcm, perm], 'math.integer') + +del patch_module diff --git a/Lib/math/integer.py b/Lib/math/integer.py new file mode 100644 index 00000000000000..a108665fdc34f2 --- /dev/null +++ b/Lib/math/integer.py @@ -0,0 +1,5 @@ +""" +math.integer module -- integer-specific mathematics functions +""" + +from _math_integer import * diff --git a/Lib/test/test_math.py b/Lib/test/test_math.py index ddeb8ad7cd62f3..c420af1c4b6c97 100644 --- a/Lib/test/test_math.py +++ b/Lib/test/test_math.py @@ -2413,6 +2413,24 @@ def assertEqualSign(self, x, y): self.assertEqual(x, y) self.assertEqual(math.copysign(1.0, x), math.copysign(1.0, y)) + def test_module(self): + # gh-140824: _math and _math_integer extensions are exported as math + # and math.integer names. + math_integer_names = set('comb factorial gcd isqrt lcm perm'.split()) + for name in dir(math): + if name.startswith('_'): + continue + obj = getattr(math, name) + if not hasattr(obj, '__module__'): + continue + + if name in math_integer_names: + module = 'math.integer' + else: + module = 'math' + with self.subTest(name=name): + self.assertEqual(obj.__module__, module) + class IsCloseTests(unittest.TestCase): isclose = math.isclose # subclasses should override this diff --git a/Modules/Setup b/Modules/Setup index 8a54c0aaec60a0..d9b84e811169b5 100644 --- a/Modules/Setup +++ b/Modules/Setup @@ -155,7 +155,7 @@ PYTHONPATH=$(COREPYTHONPATH) #array arraymodule.c #binascii binascii.c #cmath cmathmodule.c -#math mathmodule.c +#_math mathmodule.c #_math_integer mathintegermodule.c #mmap mmapmodule.c #select selectmodule.c diff --git a/Modules/Setup.stdlib.in b/Modules/Setup.stdlib.in index 2c3013e3d0c144..4633766213ae6e 100644 --- a/Modules/Setup.stdlib.in +++ b/Modules/Setup.stdlib.in @@ -52,7 +52,7 @@ @MODULE__ZONEINFO_TRUE@_zoneinfo _zoneinfo.c # needs libm -@MODULE_MATH_TRUE@math mathmodule.c +@MODULE__MATH_TRUE@_math mathmodule.c @MODULE_CMATH_TRUE@cmath cmathmodule.c @MODULE__STATISTICS_TRUE@_statistics _statisticsmodule.c diff --git a/Modules/mathmodule.c b/Modules/mathmodule.c index 82846843cfb0b2..62e4a0e38a1a50 100644 --- a/Modules/mathmodule.c +++ b/Modules/mathmodule.c @@ -2976,7 +2976,6 @@ math_ulp_impl(PyObject *module, double x) static int math_exec(PyObject *module) { - if (PyModule_Add(module, "pi", PyFloat_FromDouble(Py_MATH_PI)) < 0) { return -1; } @@ -2993,32 +2992,6 @@ math_exec(PyObject *module) if (PyModule_Add(module, "nan", PyFloat_FromDouble(fabs(Py_NAN))) < 0) { return -1; } - - PyObject *intmath = PyImport_ImportModule("_math_integer"); - if (!intmath) { - return -1; - } -#define IMPORT_FROM_INTMATH(NAME) do { \ - if (PyModule_Add(module, #NAME, \ - PyObject_GetAttrString(intmath, #NAME)) < 0) { \ - Py_DECREF(intmath); \ - return -1; \ - } \ - } while(0) - - IMPORT_FROM_INTMATH(comb); - IMPORT_FROM_INTMATH(factorial); - IMPORT_FROM_INTMATH(gcd); - IMPORT_FROM_INTMATH(isqrt); - IMPORT_FROM_INTMATH(lcm); - IMPORT_FROM_INTMATH(perm); - if (_PyImport_SetModuleString("math.integer", intmath) < 0) { - Py_DECREF(intmath); - return -1; - } - if (PyModule_Add(module, "integer", intmath) < 0) { - return -1; - } return 0; } @@ -3095,7 +3068,7 @@ PyDoc_STRVAR(module_doc, static struct PyModuleDef mathmodule = { PyModuleDef_HEAD_INIT, - .m_name = "math", + .m_name = "_math", .m_doc = module_doc, .m_size = 0, .m_methods = math_methods, @@ -3103,7 +3076,7 @@ static struct PyModuleDef mathmodule = { }; PyMODINIT_FUNC -PyInit_math(void) +PyInit__math(void) { return PyModuleDef_Init(&mathmodule); } diff --git a/configure b/configure index 8463b5b5e4a9d0..d9d319102a95f9 100755 --- a/configure +++ b/configure @@ -766,8 +766,8 @@ MODULE_FCNTL_FALSE MODULE_FCNTL_TRUE MODULE__DATETIME_FALSE MODULE__DATETIME_TRUE -MODULE_MATH_FALSE -MODULE_MATH_TRUE +MODULE__MATH_FALSE +MODULE__MATH_TRUE MODULE_CMATH_FALSE MODULE_CMATH_TRUE MODULE__STATISTICS_FALSE @@ -31905,24 +31905,24 @@ then : fi - if test "$py_cv_module_math" != "n/a" + if test "$py_cv_module__math" != "n/a" then : - py_cv_module_math=yes + py_cv_module__math=yes fi - if test "$py_cv_module_math" = yes; then - MODULE_MATH_TRUE= - MODULE_MATH_FALSE='#' + if test "$py_cv_module__math" = yes; then + MODULE__MATH_TRUE= + MODULE__MATH_FALSE='#' else - MODULE_MATH_TRUE='#' - MODULE_MATH_FALSE= + MODULE__MATH_TRUE='#' + MODULE__MATH_FALSE= fi - as_fn_append MODULE_BLOCK "MODULE_MATH_STATE=$py_cv_module_math$as_nl" - if test "x$py_cv_module_math" = xyes + as_fn_append MODULE_BLOCK "MODULE__MATH_STATE=$py_cv_module__math$as_nl" + if test "x$py_cv_module__math" = xyes then : - as_fn_append MODULE_BLOCK "MODULE_MATH_LDFLAGS=$LIBM$as_nl" + as_fn_append MODULE_BLOCK "MODULE__MATH_LDFLAGS=$LIBM$as_nl" fi @@ -34567,8 +34567,8 @@ 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_MATH_TRUE}" && test -z "${MODULE_MATH_FALSE}"; then - as_fn_error $? "conditional \"MODULE_MATH\" was never defined. +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__DATETIME_TRUE}" && test -z "${MODULE__DATETIME_FALSE}"; then diff --git a/configure.ac b/configure.ac index df94ae25e63561..66bae18ac89365 100644 --- a/configure.ac +++ b/configure.ac @@ -7913,7 +7913,7 @@ PY_STDLIB_MOD([_posixshmem], dnl needs libm PY_STDLIB_MOD_SIMPLE([_statistics], [], [$LIBM]) PY_STDLIB_MOD_SIMPLE([cmath], [], [$LIBM]) -PY_STDLIB_MOD_SIMPLE([math], [], [$LIBM]) +PY_STDLIB_MOD_SIMPLE([_math], [], [$LIBM]) dnl needs libm and on some platforms librt PY_STDLIB_MOD_SIMPLE([_datetime], [], [$TIMEMODULE_LIB $LIBM]) From f2650f71ca9be3da606d0036f35cb517673de736 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Mon, 10 Nov 2025 17:12:26 +0100 Subject: [PATCH 02/12] Remove _math_integer exec code --- Modules/mathintegermodule.c | 32 -------------------------------- 1 file changed, 32 deletions(-) diff --git a/Modules/mathintegermodule.c b/Modules/mathintegermodule.c index de5f619c9d065c..d71cf455c10c18 100644 --- a/Modules/mathintegermodule.c +++ b/Modules/mathintegermodule.c @@ -1236,39 +1236,7 @@ static PyMethodDef math_integer_methods[] = { {NULL, NULL} /* sentinel */ }; -static int -math_integer_exec(PyObject *module) -{ - /* Fix the __name__ attribute of the module and the __module__ attribute - * of its functions. - */ - PyObject *name = PyUnicode_FromString("math.integer"); - if (name == NULL) { - return -1; - } - if (PyObject_SetAttrString(module, "__name__", name) < 0) { - Py_DECREF(name); - return -1; - } - for (const PyMethodDef *m = math_integer_methods; m->ml_name; m++) { - PyObject *obj = PyObject_GetAttrString(module, m->ml_name); - if (obj == NULL) { - Py_DECREF(name); - return -1; - } - if (PyObject_SetAttrString(obj, "__module__", name) < 0) { - Py_DECREF(name); - Py_DECREF(obj); - return -1; - } - Py_DECREF(obj); - } - Py_DECREF(name); - return 0; -} - static PyModuleDef_Slot math_integer_slots[] = { - {Py_mod_exec, math_integer_exec}, {Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED}, {Py_mod_gil, Py_MOD_GIL_NOT_USED}, {0, NULL} From a6430dc86880d4abfdb96833e583c4ff5eec7a0d Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Mon, 10 Nov 2025 17:15:44 +0100 Subject: [PATCH 03/12] test_math: add MiscTests --- Lib/test/test_math.py | 39 +++++++++++++++++++++------------------ 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/Lib/test/test_math.py b/Lib/test/test_math.py index c420af1c4b6c97..074b2ff8d41f52 100644 --- a/Lib/test/test_math.py +++ b/Lib/test/test_math.py @@ -2413,24 +2413,6 @@ def assertEqualSign(self, x, y): self.assertEqual(x, y) self.assertEqual(math.copysign(1.0, x), math.copysign(1.0, y)) - def test_module(self): - # gh-140824: _math and _math_integer extensions are exported as math - # and math.integer names. - math_integer_names = set('comb factorial gcd isqrt lcm perm'.split()) - for name in dir(math): - if name.startswith('_'): - continue - obj = getattr(math, name) - if not hasattr(obj, '__module__'): - continue - - if name in math_integer_names: - module = 'math.integer' - else: - module = 'math' - with self.subTest(name=name): - self.assertEqual(obj.__module__, module) - class IsCloseTests(unittest.TestCase): isclose = math.isclose # subclasses should override this @@ -2806,6 +2788,27 @@ def assertIsNegativeZero(self, value): ) +class MiscTests(unittest.TestCase): + + def test_module_name(self): + # gh-140824: _math and _math_integer extensions are exported as math + # and math.integer names. + math_integer_names = set('comb factorial gcd isqrt lcm perm'.split()) + for name in dir(math): + if name.startswith('_'): + continue + obj = getattr(math, name) + if not hasattr(obj, '__module__'): + continue + + if name in math_integer_names: + module = 'math.integer' + else: + module = 'math' + with self.subTest(name=name): + self.assertEqual(obj.__module__, module) + + def load_tests(loader, tests, pattern): from doctest import DocFileSuite tests.addTest(DocFileSuite(os.path.join("mathdata", "ieee754.txt"))) From f510afd1bf067fd5fe3b6c29fc635a988217a31e Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Mon, 10 Nov 2025 17:16:35 +0100 Subject: [PATCH 04/12] Fix build on Windows --- PC/config.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/PC/config.c b/PC/config.c index 51b46c64d99b81..3f0db553c7930f 100644 --- a/PC/config.c +++ b/PC/config.c @@ -14,7 +14,7 @@ extern PyObject* PyInit_faulthandler(void); extern PyObject* PyInit__tracemalloc(void); extern PyObject* PyInit_gc(void); extern PyObject* PyInit__math_integer(void); -extern PyObject* PyInit_math(void); +extern PyObject* PyInit__math(void); extern PyObject* PyInit_nt(void); extern PyObject* PyInit__operator(void); extern PyObject* PyInit__signal(void); @@ -102,7 +102,7 @@ struct _inittab _PyImport_Inittab[] = { {"faulthandler", PyInit_faulthandler}, {"gc", PyInit_gc}, {"_math_integer", PyInit__math_integer}, - {"math", PyInit_math}, + {"_math", PyInit__math}, {"nt", PyInit_nt}, /* Use the NT os functions, not posix */ {"_operator", PyInit__operator}, {"_signal", PyInit__signal}, From 2d2afd6b6023f417d11ffa9c8aa57ce6214e69cb Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Mon, 10 Nov 2025 17:19:25 +0100 Subject: [PATCH 05/12] Sort lists --- Modules/Setup | 6 +++--- Modules/Setup.stdlib.in | 2 +- configure.ac | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Modules/Setup b/Modules/Setup index d9b84e811169b5..d01ed389c36059 100644 --- a/Modules/Setup +++ b/Modules/Setup @@ -141,6 +141,8 @@ PYTHONPATH=$(COREPYTHONPATH) #_interpreters _interpretersmodule.c #_json _json.c #_lsprof _lsprof.c rotatingtree.c +#_math mathmodule.c +#_math_integer mathintegermodule.c #_multiprocessing -I$(srcdir)/Modules/_multiprocessing _multiprocessing/multiprocessing.c _multiprocessing/semaphore.c #_opcode _opcode.c #_pickle _pickle.c @@ -149,17 +151,15 @@ PYTHONPATH=$(COREPYTHONPATH) #_socket socketmodule.c #_statistics _statisticsmodule.c #_struct _struct.c +#_sysconfig _sysconfig.c #_types _typesmodule.c #_typing _typingmodule.c #_zoneinfo _zoneinfo.c #array arraymodule.c #binascii binascii.c #cmath cmathmodule.c -#_math mathmodule.c -#_math_integer mathintegermodule.c #mmap mmapmodule.c #select selectmodule.c -#_sysconfig _sysconfig.c # XML #_elementtree _elementtree.c diff --git a/Modules/Setup.stdlib.in b/Modules/Setup.stdlib.in index 4633766213ae6e..298d9171d5cc23 100644 --- a/Modules/Setup.stdlib.in +++ b/Modules/Setup.stdlib.in @@ -52,8 +52,8 @@ @MODULE__ZONEINFO_TRUE@_zoneinfo _zoneinfo.c # needs libm -@MODULE__MATH_TRUE@_math mathmodule.c @MODULE_CMATH_TRUE@cmath cmathmodule.c +@MODULE__MATH_TRUE@_math mathmodule.c @MODULE__STATISTICS_TRUE@_statistics _statisticsmodule.c # _decimal uses libmpdec diff --git a/configure.ac b/configure.ac index 66bae18ac89365..2d7b8340acc90f 100644 --- a/configure.ac +++ b/configure.ac @@ -7911,9 +7911,9 @@ PY_STDLIB_MOD([_posixshmem], [$POSIXSHMEM_CFLAGS], [$POSIXSHMEM_LIBS]) dnl needs libm +PY_STDLIB_MOD_SIMPLE([_math], [], [$LIBM]) PY_STDLIB_MOD_SIMPLE([_statistics], [], [$LIBM]) PY_STDLIB_MOD_SIMPLE([cmath], [], [$LIBM]) -PY_STDLIB_MOD_SIMPLE([_math], [], [$LIBM]) dnl needs libm and on some platforms librt PY_STDLIB_MOD_SIMPLE([_datetime], [], [$TIMEMODULE_LIB $LIBM]) From d60e832feaae679fa2dc85db048c3321318225bb Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Mon, 10 Nov 2025 17:21:05 +0100 Subject: [PATCH 06/12] Fix math.integer docstring --- Lib/math/integer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/math/integer.py b/Lib/math/integer.py index a108665fdc34f2..71a06349a68b7a 100644 --- a/Lib/math/integer.py +++ b/Lib/math/integer.py @@ -1,5 +1,5 @@ """ -math.integer module -- integer-specific mathematics functions +This module provides access to integer related mathematical functions. """ from _math_integer import * From 7cf0fc1539c196b95e0e3cb5f723588b4c8391ec Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Mon, 10 Nov 2025 17:22:58 +0100 Subject: [PATCH 07/12] Fix math docstring --- Lib/math/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/math/__init__.py b/Lib/math/__init__.py index bb37649a433773..aa2e77c17ea8bb 100644 --- a/Lib/math/__init__.py +++ b/Lib/math/__init__.py @@ -1,5 +1,5 @@ """ -math module -- Mathematical functions +This module provides access to integer related mathematical functions. """ from _math import * From a20e9fb60fc54fb7eca8f60f59eda418d97ef5f8 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Mon, 10 Nov 2025 17:24:55 +0100 Subject: [PATCH 08/12] Update Lib/test/test_math.py Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com> --- Lib/test/test_math.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/test/test_math.py b/Lib/test/test_math.py index 074b2ff8d41f52..8498820c0f5b5e 100644 --- a/Lib/test/test_math.py +++ b/Lib/test/test_math.py @@ -2793,7 +2793,7 @@ class MiscTests(unittest.TestCase): def test_module_name(self): # gh-140824: _math and _math_integer extensions are exported as math # and math.integer names. - math_integer_names = set('comb factorial gcd isqrt lcm perm'.split()) + math_integer_names = {'comb', 'factorial', 'gcd', 'isqrt', 'lcm', 'perm'} for name in dir(math): if name.startswith('_'): continue From 25278572952c0d426148685d13a753ebcbd05c97 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Mon, 10 Nov 2025 17:28:29 +0100 Subject: [PATCH 09/12] Run make regen-configure --- configure | 56 +++++++++++++++++++++++++++---------------------------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/configure b/configure index d9d319102a95f9..b8c2400cfa1a21 100755 --- a/configure +++ b/configure @@ -766,12 +766,12 @@ MODULE_FCNTL_FALSE MODULE_FCNTL_TRUE MODULE__DATETIME_FALSE MODULE__DATETIME_TRUE -MODULE__MATH_FALSE -MODULE__MATH_TRUE MODULE_CMATH_FALSE MODULE_CMATH_TRUE MODULE__STATISTICS_FALSE MODULE__STATISTICS_TRUE +MODULE__MATH_FALSE +MODULE__MATH_TRUE MODULE__POSIXSHMEM_FALSE MODULE__POSIXSHMEM_TRUE MODULE__MULTIPROCESSING_FALSE @@ -31861,6 +31861,28 @@ printf "%s\n" "$py_cv_module__posixshmem" >&6; } + if test "$py_cv_module__math" != "n/a" +then : + py_cv_module__math=yes +fi + if test "$py_cv_module__math" = yes; then + MODULE__MATH_TRUE= + MODULE__MATH_FALSE='#' +else + MODULE__MATH_TRUE='#' + MODULE__MATH_FALSE= +fi + + as_fn_append MODULE_BLOCK "MODULE__MATH_STATE=$py_cv_module__math$as_nl" + if test "x$py_cv_module__math" = xyes +then : + + + as_fn_append MODULE_BLOCK "MODULE__MATH_LDFLAGS=$LIBM$as_nl" + +fi + + if test "$py_cv_module__statistics" != "n/a" then : py_cv_module__statistics=yes @@ -31905,28 +31927,6 @@ then : fi - if test "$py_cv_module__math" != "n/a" -then : - py_cv_module__math=yes -fi - if test "$py_cv_module__math" = yes; then - MODULE__MATH_TRUE= - MODULE__MATH_FALSE='#' -else - MODULE__MATH_TRUE='#' - MODULE__MATH_FALSE= -fi - - as_fn_append MODULE_BLOCK "MODULE__MATH_STATE=$py_cv_module__math$as_nl" - if test "x$py_cv_module__math" = xyes -then : - - - as_fn_append MODULE_BLOCK "MODULE__MATH_LDFLAGS=$LIBM$as_nl" - -fi - - if test "$py_cv_module__datetime" != "n/a" then : @@ -34559,6 +34559,10 @@ if test -z "${MODULE__POSIXSHMEM_TRUE}" && test -z "${MODULE__POSIXSHMEM_FALSE}" as_fn_error $? "conditional \"MODULE__POSIXSHMEM\" 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__STATISTICS_TRUE}" && test -z "${MODULE__STATISTICS_FALSE}"; then as_fn_error $? "conditional \"MODULE__STATISTICS\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 @@ -34567,10 +34571,6 @@ 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__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__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 From aaeaee1b0ad85977958fdc7ba7e4f022c040dd91 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Mon, 10 Nov 2025 17:47:24 +0100 Subject: [PATCH 10/12] Run make regen-stdlib-module-names --- Python/stdlib_module_names.h | 1 + 1 file changed, 1 insertion(+) diff --git a/Python/stdlib_module_names.h b/Python/stdlib_module_names.h index 8937e666bbbdd5..4c9670168bb614 100644 --- a/Python/stdlib_module_names.h +++ b/Python/stdlib_module_names.h @@ -51,6 +51,7 @@ static const char* _Py_stdlib_module_names[] = { "_lsprof", "_lzma", "_markupbase", +"_math", "_math_integer", "_md5", "_multibytecodec", From d36672450191aed90c5f1ce04d6a2811abadffbc Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Mon, 10 Nov 2025 17:54:33 +0100 Subject: [PATCH 11/12] Fix again the math docstring --- Lib/math/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Lib/math/__init__.py b/Lib/math/__init__.py index aa2e77c17ea8bb..47e4d01eb9f44d 100644 --- a/Lib/math/__init__.py +++ b/Lib/math/__init__.py @@ -1,5 +1,6 @@ """ -This module provides access to integer related mathematical functions. +This module provides access to the mathematical functions +defined by the C standard. """ from _math import * From 49e6b3a427bdd85f7ec6cb38c53863e7a3aada27 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Mon, 10 Nov 2025 22:28:21 +0100 Subject: [PATCH 12/12] Makefile.pre.in: update LIBSUBDIRS --- Makefile.pre.in | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile.pre.in b/Makefile.pre.in index dd28ff5d2a3ed1..18adbe1556f6ae 100644 --- a/Makefile.pre.in +++ b/Makefile.pre.in @@ -2568,6 +2568,7 @@ LIBSUBDIRS= asyncio \ importlib importlib/resources importlib/metadata \ json \ logging \ + math \ multiprocessing multiprocessing/dummy \ pathlib \ profile \