Skip to content

gh-115119: removed implicit fallback to the bundled libmpdec #134078

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

Open
wants to merge 18 commits into
base: main
Choose a base branch
from

Follow Lee on X/Twitter - Father, Husband, Serial builder creating AI, crypto, games & web tools. We are friends :) AI Will Come To Life!

Check out: eBank.nz (Art Generator) | Netwrck.com (AI Tools) | Text-Generator.io (AI API) | BitBank.nz (Crypto AI) | ReadingTime (Kids Reading) | RewordGame | BigMultiplayerChess | WebFiddle | How.nz | Helix AI Assistant

Open
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
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
7 changes: 7 additions & 0 deletions .github/workflows/posix-deps-apt.sh
Original file line number Diff line number Diff line change
@@ -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
5 changes: 5 additions & 0 deletions Doc/whatsnew/3.15.rst
Original file line number Diff line number Diff line change
@@ -293,6 +293,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
=============
Original file line number Diff line number Diff line change
@@ -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 changes: 21 additions & 25 deletions configure

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

40 changes: 20 additions & 20 deletions configure.ac
Original file line number Diff line number Diff line change
@@ -4173,31 +4173,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([
@@ -4213,16 +4212,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(
@@ -8140,6 +8130,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])
Loading
Oops, something went wrong.

Follow Lee on X/Twitter - Father, Husband, Serial builder creating AI, crypto, games & web tools. We are friends :) AI Will Come To Life!

Check out: eBank.nz (Art Generator) | Netwrck.com (AI Tools) | Text-Generator.io (AI API) | BitBank.nz (Crypto AI) | ReadingTime (Kids Reading) | RewordGame | BigMultiplayerChess | WebFiddle | How.nz | Helix AI Assistant