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

Merged
Merged
Show file tree
Hide file tree
Changes from 3 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: 6 additions & 1 deletion .github/workflows/posix-deps-apt.sh
Original file line number Diff line number Diff line change
@@ -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 \
Expand All @@ -23,4 +27,5 @@ apt-get -yq install \
tk-dev \
uuid-dev \
xvfb \
zlib1g-dev
zlib1g-dev \
libmpdec-dev
6 changes: 6 additions & 0 deletions Doc/using/configure.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 2 additions & 0 deletions Doc/whatsnew/3.15.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the devguide need updating? For example the macOS build instructions say to use --with-system-libmpdec, do we want people to stop using that for 3.15+?

https://devguide.python.org/getting-started/setup-building/#install-dependencies

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can just drop this option. It's specified in 3.13+ instructions (where it's default to "yes"). I'll prepare a patch.

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`.)


Expand Down
33 changes: 25 additions & 8 deletions configure

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

26 changes: 18 additions & 8 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -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],
Expand All @@ -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])
Expand Down Expand Up @@ -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(
Expand Down
Loading