gh-115119: Remove implicit fallback to the bundled libmpdec (#134078)
Some checks are pending
Tests / Change detection (push) Waiting to run
Tests / Docs (push) Blocked by required conditions
Tests / Check if Autoconf files are up to date (push) Blocked by required conditions
Tests / Check if generated files are up to date (push) Blocked by required conditions
Tests / (push) Blocked by required conditions
Tests / Windows MSI (push) Blocked by required conditions
Tests / Ubuntu SSL tests with OpenSSL (push) Blocked by required conditions
Tests / WASI (push) Blocked by required conditions
Tests / Hypothesis tests on Ubuntu (push) Blocked by required conditions
Tests / Address sanitizer (push) Blocked by required conditions
Tests / Undefined behavior sanitizer (push) Blocked by required conditions
Tests / Cross build Linux (push) Blocked by required conditions
Tests / CIFuzz (push) Blocked by required conditions
Tests / All required checks pass (push) Blocked by required conditions
Lint / lint (push) Waiting to run
mypy / Run mypy on Lib/_pyrepl (push) Waiting to run
mypy / Run mypy on Lib/test/libregrtest (push) Waiting to run
mypy / Run mypy on Lib/tomllib (push) Waiting to run
mypy / Run mypy on Tools/build (push) Waiting to run
mypy / Run mypy on Tools/cases_generator (push) Waiting to run
mypy / Run mypy on Tools/clinic (push) Waiting to run
mypy / Run mypy on Tools/jit (push) Waiting to run
mypy / Run mypy on Tools/peg_generator (push) Waiting to run
Tail calling interpreter / aarch64-apple-darwin/clang (push) Waiting to run
Tail calling interpreter / aarch64-unknown-linux-gnu/gcc (push) Waiting to run
Tail calling interpreter / x86_64-pc-windows-msvc/msvc (push) Waiting to run
Tail calling interpreter / x86_64-apple-darwin/clang (push) Waiting to run
Tail calling interpreter / free-threading (push) Waiting to run
Tail calling interpreter / x86_64-unknown-linux-gnu/gcc (push) Waiting to run

Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
This commit is contained in:
Sergey B Kirpichev 2025-07-01 18:50:51 +03:00 committed by GitHub
parent 93809a918f
commit 17cf0a343b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 59 additions and 47 deletions

View file

@ -25,3 +25,10 @@ apt-get -yq install \
uuid-dev \
xvfb \
zlib1g-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
apt-get -yq install libmpdec-dev

View file

@ -310,6 +310,11 @@ that may require changes to your code.
Build changes
=============
* 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`.
(Contributed by Sergey B Kirpichev in :gh:`115119`.)
C API changes
=============

View file

@ -0,0 +1,4 @@
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.

46
configure generated vendored
View file

@ -15750,10 +15750,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
@ -15762,8 +15770,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 :
@ -15841,13 +15847,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
@ -15894,21 +15893,6 @@ 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.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;} ;;
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;}
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
# Disable forced inlining in debug builds, see GH-94847
@ -33194,6 +33178,18 @@ fi
printf "%s\n" "$py_cv_module__decimal" >&6; }
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 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;}
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for stdlib extension module _dbm" >&5
printf %s "checking for stdlib extension module _dbm... " >&6; }
if test "$py_cv_module__dbm" != "n/a"

View file

@ -4169,22 +4169,22 @@ fi
# Check for use of the system libmpdec library
AC_MSG_CHECKING([for --with-system-libmpdec])
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)]
)],
[],
[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])
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])
AS_VAR_IF(
[with_system_libmpdec], [yes],
@ -4192,8 +4192,7 @@ AS_VAR_IF(
[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([
@ -4209,16 +4208,7 @@ AS_VAR_IF([with_system_libmpdec], [yes],
], [const char *x = mpd_version();])],
[have_mpdec=yes],
[have_mpdec=no])
])],
[AC_MSG_WARN([m4_normalize([
the bundled copy of libmpdecimal is scheduled for removal in Python 3.15;
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)])])
USE_BUNDLED_LIBMPDEC()])
])])
# Disable forced inlining in debug builds, see GH-94847
AS_VAR_IF(
@ -8136,6 +8126,16 @@ PY_STDLIB_MOD([_curses_panel],
PY_STDLIB_MOD([_decimal],
[], [test "$have_mpdec" = "yes"],
[$LIBMPDEC_CFLAGS], [$LIBMPDEC_LIBS])
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 pure-Python version
for the decimal module])])])
PY_STDLIB_MOD([_dbm],
[test -n "$with_dbmliborder"], [test "$have_dbm" != "no"],
[$DBM_CFLAGS], [$DBM_LIBS])