From 14266c877d512cd75e80d953a6cd6fa6d6bbfa5c Mon Sep 17 00:00:00 2001 From: Sergey B Kirpichev Date: Wed, 14 May 2025 13:58:03 +0300 Subject: [PATCH 1/9] gh-115119: defer removal of bundled libmpdec to 3.16 (configure changes) --- configure | 8 ++++---- configure.ac | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/configure b/configure index 2649a800f91a48..b822e3fc75eddb 100755 --- a/configure +++ b/configure @@ -15711,15 +15711,15 @@ LIBS=$save_LIBS else case e in #( - e) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: the bundled copy of libmpdecimal is scheduled for removal in Python 3.15; consider using a system installed mpdecimal library." >&5 -printf "%s\n" "$as_me: WARNING: the bundled copy of libmpdecimal is scheduled for removal in Python 3.15; consider using a system installed mpdecimal library." >&2;} ;; + e) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: the bundled copy of libmpdecimal is scheduled for removal in Python 3.16; consider using a system installed mpdecimal library." >&5 +printf "%s\n" "$as_me: WARNING: the bundled copy of libmpdecimal is scheduled for removal in Python 3.16; consider using a system installed mpdecimal library." >&2;} ;; esac fi if test "$with_system_libmpdec" = "yes" && test "$have_mpdec" = "no" then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: no system libmpdecimal found; falling back to bundled libmpdecimal (deprecated and scheduled for removal in Python 3.15)" >&5 -printf "%s\n" "$as_me: WARNING: no system libmpdecimal found; falling back to bundled libmpdecimal (deprecated and scheduled for removal in Python 3.15)" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: no system libmpdecimal found; falling back to bundled libmpdecimal (deprecated and scheduled for removal in Python 3.16)" >&5 +printf "%s\n" "$as_me: WARNING: no system libmpdecimal found; falling back to bundled libmpdecimal (deprecated and scheduled for removal in Python 3.16)" >&2;} LIBMPDEC_CFLAGS="-I\$(srcdir)/Modules/_decimal/libmpdec" LIBMPDEC_LIBS="-lm \$(LIBMPDEC_A)" LIBMPDEC_INTERNAL="\$(LIBMPDEC_HEADERS) \$(LIBMPDEC_A)" diff --git a/configure.ac b/configure.ac index 5525a5b0ed5240..9014cc9c458a8e 100644 --- a/configure.ac +++ b/configure.ac @@ -4134,13 +4134,13 @@ AS_VAR_IF([with_system_libmpdec], [yes], [have_mpdec=no]) ])], [AC_MSG_WARN([m4_normalize([ - the bundled copy of libmpdecimal is scheduled for removal in Python 3.15; + the bundled copy of libmpdecimal is scheduled for removal in Python 3.16; consider using a system installed mpdecimal library.])])]) AS_IF([test "$with_system_libmpdec" = "yes" && test "$have_mpdec" = "no"], [AC_MSG_WARN([m4_normalize([ no system libmpdecimal found; falling back to bundled libmpdecimal - (deprecated and scheduled for removal in Python 3.15)])]) + (deprecated and scheduled for removal in Python 3.16)])]) USE_BUNDLED_LIBMPDEC()]) # Disable forced inlining in debug builds, see GH-94847 From 39d1e6b4bee754197375ecfdd89d4f622f23b4f8 Mon Sep 17 00:00:00 2001 From: Sergey B Kirpichev Date: Fri, 16 May 2025 07:50:29 +0300 Subject: [PATCH 2/9] gh-115119: removed implicit fallback to the bundled libmpdec --- .github/workflows/build.yml | 6 ++- Doc/whatsnew/3.15.rst | 5 +++ ...-05-16-07-46-06.gh-issue-115119.ALBgS_.rst | 4 ++ configure | 38 +++++++++---------- configure.ac | 30 +++++++-------- 5 files changed, 45 insertions(+), 38 deletions(-) create mode 100644 Misc/NEWS.d/next/Build/2025-05-16-07-46-06.gh-issue-115119.ALBgS_.rst diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b192508c78685c..63024fe3bb38e0 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -90,7 +90,7 @@ jobs: name: 'Check if generated files are up to date' # Don't use ubuntu-latest but a specific version to make the job # reproducible: to get the same tools versions (autoconf, aclocal, ...) - runs-on: ubuntu-24.04 + runs-on: ubuntu-22.04 timeout-minutes: 60 needs: build-context if: needs.build-context.outputs.run-tests == 'true' @@ -110,7 +110,9 @@ jobs: # Include env.pythonLocation in key to avoid changes in environment when setup-python updates Python key: ${{ github.job }}-${{ env.IMAGE_OS_VERSION }}-${{ needs.build-context.outputs.config-hash }}-${{ env.pythonLocation }} - name: Install dependencies - run: sudo ./.github/workflows/posix-deps-apt.sh + run: | + sudo ./.github/workflows/posix-deps-apt.sh + sudo apt-get -yq install libmpdec-dev - name: Add ccache to PATH run: echo "PATH=/usr/lib/ccache:$PATH" >> "$GITHUB_ENV" - name: Configure ccache action diff --git a/Doc/whatsnew/3.15.rst b/Doc/whatsnew/3.15.rst index 14d96420f698fa..4c15afed1f61d4 100644 --- a/Doc/whatsnew/3.15.rst +++ b/Doc/whatsnew/3.15.rst @@ -163,6 +163,11 @@ that may require changes to your code. Build changes ============= +* Removed implicit fallback to the buildled copy of the ``libmpdec`` library. + Now this should be explicitly enabled with :option:`--with-system-libmpdec` + set to ``no`` or with :option:`!--without-system-libmpdec`. + (Contributed by Sergey B Kirpichev in :gh:`115119`.) + C API changes ============= diff --git a/Misc/NEWS.d/next/Build/2025-05-16-07-46-06.gh-issue-115119.ALBgS_.rst b/Misc/NEWS.d/next/Build/2025-05-16-07-46-06.gh-issue-115119.ALBgS_.rst new file mode 100644 index 00000000000000..a4be6f4d521139 --- /dev/null +++ b/Misc/NEWS.d/next/Build/2025-05-16-07-46-06.gh-issue-115119.ALBgS_.rst @@ -0,0 +1,4 @@ +Removed implicit fallback to the buildled copy of the ``libmpdec`` library. +Now this should be explicitly enabled with :option:`--with-system-libmpdec` +set to ``no`` or with :option:`!--without-system-libmpdec`. Patch by Sergey +B Kirpichev. diff --git a/configure b/configure index b822e3fc75eddb..7114956494a717 100755 --- a/configure +++ b/configure @@ -15566,10 +15566,18 @@ fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for --with-system-libmpdec" >&5 printf %s "checking for --with-system-libmpdec... " >&6; } + # Check whether --with-system_libmpdec was given. if test ${with_system_libmpdec+y} then : - withval=$with_system_libmpdec; + withval=$with_system_libmpdec; if test "x$with_system_libmpdec" = xno +then : + LIBMPDEC_CFLAGS="-I\$(srcdir)/Modules/_decimal/libmpdec" + LIBMPDEC_LIBS="-lm \$(LIBMPDEC_A)" + LIBMPDEC_INTERNAL="\$(LIBMPDEC_HEADERS) \$(LIBMPDEC_A)" + have_mpdec=yes + with_system_libmpdec=no +fi else case e in #( e) with_system_libmpdec="yes" ;; esac @@ -15578,8 +15586,6 @@ fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $with_system_libmpdec" >&5 printf "%s\n" "$with_system_libmpdec" >&6; } - - if test "x$with_system_libmpdec" = xyes then : @@ -15657,13 +15663,6 @@ else printf "%s\n" "yes" >&6; } fi -else case e in #( - e) LIBMPDEC_CFLAGS="-I\$(srcdir)/Modules/_decimal/libmpdec" - LIBMPDEC_LIBS="-lm \$(LIBMPDEC_A)" - LIBMPDEC_INTERNAL="\$(LIBMPDEC_HEADERS) \$(LIBMPDEC_A)" - have_mpdec=yes - with_system_libmpdec=no ;; -esac fi if test "x$with_system_libmpdec" = xyes @@ -15710,21 +15709,18 @@ LDFLAGS=$save_LDFLAGS LIBS=$save_LIBS -else case e in #( - e) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: the bundled copy of libmpdecimal is scheduled for removal in Python 3.16; consider using a system installed mpdecimal library." >&5 -printf "%s\n" "$as_me: WARNING: the bundled copy of libmpdecimal is scheduled for removal in Python 3.16; consider using a system installed mpdecimal library." >&2;} ;; -esac +fi +if test "x$with_system_libmpdec" = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: the bundled copy of libmpdecimal is scheduled for removal in Python 3.16; consider using a system installed mpdecimal library." >&5 +printf "%s\n" "$as_me: WARNING: the bundled copy of libmpdecimal is scheduled for removal in Python 3.16; consider using a system installed mpdecimal library." >&2;} fi if test "$with_system_libmpdec" = "yes" && test "$have_mpdec" = "no" then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: no system libmpdecimal found; falling back to bundled libmpdecimal (deprecated and scheduled for removal in Python 3.16)" >&5 -printf "%s\n" "$as_me: WARNING: no system libmpdecimal found; falling back to bundled libmpdecimal (deprecated and scheduled for removal in Python 3.16)" >&2;} - LIBMPDEC_CFLAGS="-I\$(srcdir)/Modules/_decimal/libmpdec" - LIBMPDEC_LIBS="-lm \$(LIBMPDEC_A)" - LIBMPDEC_INTERNAL="\$(LIBMPDEC_HEADERS) \$(LIBMPDEC_A)" - have_mpdec=yes - with_system_libmpdec=no + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: no system libmpdecimal found; falling back to pure-Python version for the decimal module" >&5 +printf "%s\n" "$as_me: WARNING: no system libmpdecimal found; falling back to pure-Python version for the decimal module" >&2;} + py_cv_module__decimal=n/a fi # Disable forced inlining in debug builds, see GH-94847 diff --git a/configure.ac b/configure.ac index 9014cc9c458a8e..14b5bf3eb8c83a 100644 --- a/configure.ac +++ b/configure.ac @@ -4092,31 +4092,30 @@ fi # Check for use of the system libmpdec library AC_MSG_CHECKING([for --with-system-libmpdec]) +AC_DEFUN([USE_BUNDLED_LIBMPDEC], + [LIBMPDEC_CFLAGS="-I\$(srcdir)/Modules/_decimal/libmpdec" + LIBMPDEC_LIBS="-lm \$(LIBMPDEC_A)" + LIBMPDEC_INTERNAL="\$(LIBMPDEC_HEADERS) \$(LIBMPDEC_A)" + have_mpdec=yes + with_system_libmpdec=no]) AC_ARG_WITH( [system_libmpdec], [AS_HELP_STRING( [--with-system-libmpdec], [build _decimal module using an installed mpdecimal library, see Doc/library/decimal.rst (default is yes)] )], - [], + [AS_IF([test "x$with_system_libmpdec" = xno], + [USE_BUNDLED_LIBMPDEC()])], [with_system_libmpdec="yes"]) AC_MSG_RESULT([$with_system_libmpdec]) -AC_DEFUN([USE_BUNDLED_LIBMPDEC], - [LIBMPDEC_CFLAGS="-I\$(srcdir)/Modules/_decimal/libmpdec" - LIBMPDEC_LIBS="-lm \$(LIBMPDEC_A)" - LIBMPDEC_INTERNAL="\$(LIBMPDEC_HEADERS) \$(LIBMPDEC_A)" - have_mpdec=yes - with_system_libmpdec=no]) - AS_VAR_IF( [with_system_libmpdec], [yes], [PKG_CHECK_MODULES( [LIBMPDEC], [libmpdec >= 2.5.0], [], [LIBMPDEC_CFLAGS=${LIBMPDEC_CFLAGS-""} LIBMPDEC_LIBS=${LIBMPDEC_LIBS-"-lmpdec -lm"} - LIBMPDEC_INTERNAL=])], - [USE_BUNDLED_LIBMPDEC()]) + LIBMPDEC_INTERNAL=])]) AS_VAR_IF([with_system_libmpdec], [yes], [WITH_SAVE_ENV([ @@ -4132,16 +4131,17 @@ AS_VAR_IF([with_system_libmpdec], [yes], ], [const char *x = mpd_version();])], [have_mpdec=yes], [have_mpdec=no]) - ])], - [AC_MSG_WARN([m4_normalize([ + ])]) +AS_VAR_IF([with_system_libmpdec], [no], + [AC_MSG_WARN([m4_normalize([ the bundled copy of libmpdecimal is scheduled for removal in Python 3.16; consider using a system installed mpdecimal library.])])]) AS_IF([test "$with_system_libmpdec" = "yes" && test "$have_mpdec" = "no"], [AC_MSG_WARN([m4_normalize([ - no system libmpdecimal found; falling back to bundled libmpdecimal - (deprecated and scheduled for removal in Python 3.16)])]) - USE_BUNDLED_LIBMPDEC()]) + no system libmpdecimal found; falling back to pure-Python version + for the decimal module])]) + AS_VAR_SET([py_cv_module_]_decimal, [n/a])]) # Disable forced inlining in debug builds, see GH-94847 AS_VAR_IF( From b328702d9c0d4b6163e372d5886e63ab5246f7a3 Mon Sep 17 00:00:00 2001 From: Sergey B Kirpichev Date: Fri, 16 May 2025 13:30:27 +0300 Subject: [PATCH 3/9] address review: remove runner version downgrade --- .github/workflows/build.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 63024fe3bb38e0..b192508c78685c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -90,7 +90,7 @@ jobs: name: 'Check if generated files are up to date' # Don't use ubuntu-latest but a specific version to make the job # reproducible: to get the same tools versions (autoconf, aclocal, ...) - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 timeout-minutes: 60 needs: build-context if: needs.build-context.outputs.run-tests == 'true' @@ -110,9 +110,7 @@ jobs: # Include env.pythonLocation in key to avoid changes in environment when setup-python updates Python key: ${{ github.job }}-${{ env.IMAGE_OS_VERSION }}-${{ needs.build-context.outputs.config-hash }}-${{ env.pythonLocation }} - name: Install dependencies - run: | - sudo ./.github/workflows/posix-deps-apt.sh - sudo apt-get -yq install libmpdec-dev + run: sudo ./.github/workflows/posix-deps-apt.sh - name: Add ccache to PATH run: echo "PATH=/usr/lib/ccache:$PATH" >> "$GITHUB_ENV" - name: Configure ccache action From 94ce315bf6833241b6286325a2674ca336e37297 Mon Sep 17 00:00:00 2001 From: Sergey B Kirpichev Date: Tue, 3 Jun 2025 06:55:11 +0300 Subject: [PATCH 4/9] + use libmpdec-dev from PPA for PHP --- .github/workflows/posix-deps-apt.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/posix-deps-apt.sh b/.github/workflows/posix-deps-apt.sh index d5538cd9367ec6..ec75be08e16e05 100755 --- a/.github/workflows/posix-deps-apt.sh +++ b/.github/workflows/posix-deps-apt.sh @@ -1,4 +1,8 @@ #!/bin/sh + +# Workaround missing on ubuntu 24.04 libmpdec-dev +sudo add-apt-repository ppa:ondrej/php + apt-get update apt-get -yq install \ @@ -23,4 +27,5 @@ apt-get -yq install \ tk-dev \ uuid-dev \ xvfb \ - zlib1g-dev + zlib1g-dev \ + libmpdec-dev From 4c98b8d1af1b754d7d1d5864145d859156d8381d Mon Sep 17 00:00:00 2001 From: Sergey B Kirpichev Date: Tue, 3 Jun 2025 08:57:54 +0300 Subject: [PATCH 5/9] address review: add --with-libmpdec option --- Doc/using/configure.rst | 6 ++++++ Doc/whatsnew/3.15.rst | 2 ++ configure | 33 +++++++++++++++++++++++++-------- configure.ac | 26 ++++++++++++++++++-------- 4 files changed, 51 insertions(+), 16 deletions(-) diff --git a/Doc/using/configure.rst b/Doc/using/configure.rst index b914d3397b6dda..6e2d7da7aa9dd9 100644 --- a/Doc/using/configure.rst +++ b/Doc/using/configure.rst @@ -851,6 +851,12 @@ Libraries options .. seealso:: :option:`LIBMPDEC_CFLAGS` and :option:`LIBMPDEC_LIBS`. +.. option:: --with-libmpdec + + Whether build the ``_decimal`` extension module. + + .. versionadded:: next + .. option:: --with-readline=readline|editline Designate a backend library for the :mod:`readline` module. diff --git a/Doc/whatsnew/3.15.rst b/Doc/whatsnew/3.15.rst index 6596ff07c5003f..b30b9cca65347b 100644 --- a/Doc/whatsnew/3.15.rst +++ b/Doc/whatsnew/3.15.rst @@ -257,6 +257,8 @@ Build changes * Removed implicit fallback to the buildled copy of the ``libmpdec`` library. Now this should be explicitly enabled with :option:`--with-system-libmpdec` set to ``no`` or with :option:`!--without-system-libmpdec`. + The :option:`!--without-libmpdec` should be used to permit building of + the CPython without the ``_decimal`` module. (Contributed by Sergey B Kirpichev in :gh:`115119`.) diff --git a/configure b/configure index 85261d79ab5fb5..b97b2287722adc 100755 --- a/configure +++ b/configure @@ -1112,6 +1112,7 @@ with_hash_algorithm with_tzpath with_libs with_system_expat +with_libmpdec with_system_libmpdec with_decimal_contextvar enable_loadable_sqlite_extensions @@ -1909,6 +1910,7 @@ Optional Packages: --with-libs='lib1 ...' link against additional libs (default is no) --with-system-expat build pyexpat module using an installed expat library, see Doc/library/pyexpat.rst (default is no) + --with-libmpdec build _decimal module (default is yes) --with-system-libmpdec build _decimal module using an installed mpdecimal library, see Doc/library/decimal.rst (default is yes) @@ -15753,6 +15755,19 @@ printf "%s\n" "#define Py_FFI_SUPPORT_C_COMPLEX 1" >>confdefs.h fi +# Check for use of the libmpdec library +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for --with-libmpdec" >&5 +printf %s "checking for --with-libmpdec... " >&6; } + +# Check whether --with-libmpdec was given. +if test ${with_libmpdec+y} +then : + withval=$with_libmpdec; +fi + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $with_libmpdec" >&5 +printf "%s\n" "$with_libmpdec" >&6; } + # Check for use of the system libmpdec library { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for --with-system-libmpdec" >&5 printf %s "checking for --with-system-libmpdec... " >&6; } @@ -15761,7 +15776,7 @@ printf %s "checking for --with-system-libmpdec... " >&6; } # Check whether --with-system_libmpdec was given. if test ${with_system_libmpdec+y} then : - withval=$with_system_libmpdec; if test "x$with_system_libmpdec" = xno + withval=$with_system_libmpdec; if test "x$with_system_libmpdec" = xno && test "x$with_libmpdec" = xyes then : LIBMPDEC_CFLAGS="-I\$(srcdir)/Modules/_decimal/libmpdec" LIBMPDEC_LIBS="-lm \$(LIBMPDEC_A)" @@ -15901,17 +15916,19 @@ LIBS=$save_LIBS fi -if test "x$with_system_libmpdec" = xno +if test "$with_system_libmpdec" = "no" && test "$with_libmpdec" = "yes" then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: the bundled copy of libmpdecimal is scheduled for removal in Python 3.16; consider using a system installed mpdecimal library." >&5 -printf "%s\n" "$as_me: WARNING: the bundled copy of libmpdecimal is scheduled for removal in Python 3.16; consider using a system installed mpdecimal library." >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: the bundled copy of libmpdec is scheduled for removal in Python 3.16; consider using a system installed mpdecimal library." >&5 +printf "%s\n" "$as_me: WARNING: the bundled copy of libmpdec is scheduled for removal in Python 3.16; consider using a system installed mpdecimal library." >&2;} fi -if test "$with_system_libmpdec" = "yes" && test "$have_mpdec" = "no" +if test "$with_libmpdec" = "yes" && test "$have_mpdec" = "no" +then : + as_fn_error $? "no system libmpdec found; use --without-libmpdec to build Python with only pure-Python version for the decimal module" "$LINENO" 5 +fi +if test "x$with_libmpdec" = xno then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: no system libmpdecimal found; falling back to pure-Python version for the decimal module" >&5 -printf "%s\n" "$as_me: WARNING: no system libmpdecimal found; falling back to pure-Python version for the decimal module" >&2;} - py_cv_module__decimal=n/a + py_cv_module__decimal=n/a fi # Disable forced inlining in debug builds, see GH-94847 diff --git a/configure.ac b/configure.ac index 3e96c2c5081996..531ef8b4200541 100644 --- a/configure.ac +++ b/configure.ac @@ -4171,6 +4171,16 @@ if test "$ac_cv_ffi_complex_double_supported" = "yes"; then [Defined if _Complex C type can be used with libffi.]) fi +# Check for use of the libmpdec library +AC_MSG_CHECKING([for --with-libmpdec]) +AC_ARG_WITH( + [libmpdec], + [AS_HELP_STRING( + [--with-libmpdec], + [build _decimal module (default is yes)] + )]) +AC_MSG_RESULT([$with_libmpdec]) + # Check for use of the system libmpdec library AC_MSG_CHECKING([for --with-system-libmpdec]) AC_DEFUN([USE_BUNDLED_LIBMPDEC], @@ -4185,7 +4195,7 @@ AC_ARG_WITH( [--with-system-libmpdec], [build _decimal module using an installed mpdecimal library, see Doc/library/decimal.rst (default is yes)] )], - [AS_IF([test "x$with_system_libmpdec" = xno], + [AS_IF([test "x$with_system_libmpdec" = xno && test "x$with_libmpdec" = xyes], [USE_BUNDLED_LIBMPDEC()])], [with_system_libmpdec="yes"]) AC_MSG_RESULT([$with_system_libmpdec]) @@ -4213,16 +4223,16 @@ AS_VAR_IF([with_system_libmpdec], [yes], [have_mpdec=yes], [have_mpdec=no]) ])]) -AS_VAR_IF([with_system_libmpdec], [no], +AS_IF([test "$with_system_libmpdec" = "no" && test "$with_libmpdec" = "yes"], [AC_MSG_WARN([m4_normalize([ - the bundled copy of libmpdecimal is scheduled for removal in Python 3.16; + the bundled copy of libmpdec is scheduled for removal in Python 3.16; consider using a system installed mpdecimal library.])])]) -AS_IF([test "$with_system_libmpdec" = "yes" && test "$have_mpdec" = "no"], - [AC_MSG_WARN([m4_normalize([ - no system libmpdecimal found; falling back to pure-Python version - for the decimal module])]) - AS_VAR_SET([py_cv_module_]_decimal, [n/a])]) +AS_IF([test "$with_libmpdec" = "yes" && test "$have_mpdec" = "no"], + [AC_MSG_ERROR([m4_normalize([ + no system libmpdec found; use --without-libmpdec to build Python with only pure-Python version for the decimal module])])]) +AS_VAR_IF([with_libmpdec], [no], + [AS_VAR_SET([py_cv_module_]_decimal, [n/a])]) # Disable forced inlining in debug builds, see GH-94847 AS_VAR_IF( From 6cd1730c56c84e20e511eb38ace52cfc1c292a30 Mon Sep 17 00:00:00 2001 From: Sergey B Kirpichev Date: Tue, 3 Jun 2025 10:33:16 +0300 Subject: [PATCH 6/9] Update .github/workflows/posix-deps-apt.sh Co-authored-by: Victor Stinner --- .github/workflows/posix-deps-apt.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/posix-deps-apt.sh b/.github/workflows/posix-deps-apt.sh index ec75be08e16e05..06fd0667635104 100755 --- a/.github/workflows/posix-deps-apt.sh +++ b/.github/workflows/posix-deps-apt.sh @@ -1,6 +1,8 @@ #!/bin/sh -# Workaround missing on ubuntu 24.04 libmpdec-dev +# Workaround missing libmpdec-dev on ubuntu 24.04: +# https://launchpad.net/~ondrej/+archive/ubuntu/php +# https://deb.sury.org/ sudo add-apt-repository ppa:ondrej/php apt-get update From 9d29df132af049b07ad196d05a7e4202e04473ac Mon Sep 17 00:00:00 2001 From: Sergey B Kirpichev Date: Tue, 10 Jun 2025 05:03:22 +0300 Subject: [PATCH 7/9] Apply suggestions from code review Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> --- Doc/using/configure.rst | 2 +- Doc/whatsnew/3.15.rst | 6 +++--- .../Build/2025-05-16-07-46-06.gh-issue-115119.ALBgS_.rst | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Doc/using/configure.rst b/Doc/using/configure.rst index 6e2d7da7aa9dd9..3becffe3938b1c 100644 --- a/Doc/using/configure.rst +++ b/Doc/using/configure.rst @@ -853,7 +853,7 @@ Libraries options .. option:: --with-libmpdec - Whether build the ``_decimal`` extension module. + Whether to build the ``_decimal`` extension module. .. versionadded:: next diff --git a/Doc/whatsnew/3.15.rst b/Doc/whatsnew/3.15.rst index b30b9cca65347b..60c0eba5900140 100644 --- a/Doc/whatsnew/3.15.rst +++ b/Doc/whatsnew/3.15.rst @@ -254,11 +254,11 @@ that may require changes to your code. Build changes ============= -* Removed implicit fallback to the buildled copy of the ``libmpdec`` library. +* Removed implicit fallback to the bundled copy of the ``libmpdec`` library. Now this should be explicitly enabled with :option:`--with-system-libmpdec` set to ``no`` or with :option:`!--without-system-libmpdec`. - The :option:`!--without-libmpdec` should be used to permit building of - the CPython without the ``_decimal`` module. + The :option:`!--without-libmpdec` should be used to permit building + CPython without the ``_decimal`` module. (Contributed by Sergey B Kirpichev in :gh:`115119`.) diff --git a/Misc/NEWS.d/next/Build/2025-05-16-07-46-06.gh-issue-115119.ALBgS_.rst b/Misc/NEWS.d/next/Build/2025-05-16-07-46-06.gh-issue-115119.ALBgS_.rst index a4be6f4d521139..8c2d15a3228fcf 100644 --- a/Misc/NEWS.d/next/Build/2025-05-16-07-46-06.gh-issue-115119.ALBgS_.rst +++ b/Misc/NEWS.d/next/Build/2025-05-16-07-46-06.gh-issue-115119.ALBgS_.rst @@ -1,4 +1,4 @@ -Removed implicit fallback to the buildled copy of the ``libmpdec`` library. -Now this should be explicitly enabled with :option:`--with-system-libmpdec` -set to ``no`` or with :option:`!--without-system-libmpdec`. Patch by Sergey +Removed implicit fallback to the bundled copy of the ``libmpdec`` library. +Now this should be explicitly enabled via :option:`--with-system-libmpdec` +set to ``no`` or :option:`!--without-system-libmpdec`. Patch by Sergey B Kirpichev. From d53bdf391a7f6bb27ceed1126a481b90de11b608 Mon Sep 17 00:00:00 2001 From: Sergey B Kirpichev Date: Tue, 10 Jun 2025 05:08:21 +0300 Subject: [PATCH 8/9] address review: reorder list in posix-deps-apt.sh --- .github/workflows/posix-deps-apt.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/posix-deps-apt.sh b/.github/workflows/posix-deps-apt.sh index b38253e244091f..cc565ecf0eb00c 100755 --- a/.github/workflows/posix-deps-apt.sh +++ b/.github/workflows/posix-deps-apt.sh @@ -19,6 +19,7 @@ apt-get -yq install \ libgdbm-dev \ libgdbm-compat-dev \ liblzma-dev \ + libmpdec-dev \ libncurses5-dev \ libreadline6-dev \ libsqlite3-dev \ @@ -30,5 +31,4 @@ apt-get -yq install \ tk-dev \ uuid-dev \ xvfb \ - zlib1g-dev \ - libmpdec-dev + zlib1g-dev From c3a188990ab4126e4e0dd540770618e5ba273314 Mon Sep 17 00:00:00 2001 From: Sergey B Kirpichev Date: Tue, 10 Jun 2025 13:33:54 +0300 Subject: [PATCH 9/9] address review: expand --with-libmpdec description --- Doc/using/configure.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Doc/using/configure.rst b/Doc/using/configure.rst index 3becffe3938b1c..c87332ab7addbf 100644 --- a/Doc/using/configure.rst +++ b/Doc/using/configure.rst @@ -853,7 +853,8 @@ Libraries options .. option:: --with-libmpdec - Whether to build the ``_decimal`` extension module. + Whether to build the ``_decimal`` extension module (default is yes). + See also the :option:`--with-system-libmpdec` option. .. versionadded:: next