Skip to content

Commit 39d1e6b

Browse files
committed
pythongh-115119: removed implicit fallback to the bundled libmpdec
1 parent 14266c8 commit 39d1e6b

File tree

5 files changed

+45
-38
lines changed

5 files changed

+45
-38
lines changed

.github/workflows/build.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ jobs:
9090
name: 'Check if generated files are up to date'
9191
# Don't use ubuntu-latest but a specific version to make the job
9292
# reproducible: to get the same tools versions (autoconf, aclocal, ...)
93-
runs-on: ubuntu-24.04
93+
runs-on: ubuntu-22.04
9494
timeout-minutes: 60
9595
needs: build-context
9696
if: needs.build-context.outputs.run-tests == 'true'
@@ -110,7 +110,9 @@ jobs:
110110
# Include env.pythonLocation in key to avoid changes in environment when setup-python updates Python
111111
key: ${{ github.job }}-${{ env.IMAGE_OS_VERSION }}-${{ needs.build-context.outputs.config-hash }}-${{ env.pythonLocation }}
112112
- name: Install dependencies
113-
run: sudo ./.github/workflows/posix-deps-apt.sh
113+
run: |
114+
sudo ./.github/workflows/posix-deps-apt.sh
115+
sudo apt-get -yq install libmpdec-dev
114116
- name: Add ccache to PATH
115117
run: echo "PATH=/usr/lib/ccache:$PATH" >> "$GITHUB_ENV"
116118
- name: Configure ccache action

Doc/whatsnew/3.15.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,11 @@ that may require changes to your code.
163163
Build changes
164164
=============
165165

166+
* Removed implicit fallback to the buildled copy of the ``libmpdec`` library.
167+
Now this should be explicitly enabled with :option:`--with-system-libmpdec`
168+
set to ``no`` or with :option:`!--without-system-libmpdec`.
169+
(Contributed by Sergey B Kirpichev in :gh:`115119`.)
170+
166171

167172
C API changes
168173
=============
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Removed implicit fallback to the buildled copy of the ``libmpdec`` library.
2+
Now this should be explicitly enabled with :option:`--with-system-libmpdec`
3+
set to ``no`` or with :option:`!--without-system-libmpdec`. Patch by Sergey
4+
B Kirpichev.

configure

Lines changed: 17 additions & 21 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

configure.ac

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4092,31 +4092,30 @@ fi
40924092

40934093
# Check for use of the system libmpdec library
40944094
AC_MSG_CHECKING([for --with-system-libmpdec])
4095+
AC_DEFUN([USE_BUNDLED_LIBMPDEC],
4096+
[LIBMPDEC_CFLAGS="-I\$(srcdir)/Modules/_decimal/libmpdec"
4097+
LIBMPDEC_LIBS="-lm \$(LIBMPDEC_A)"
4098+
LIBMPDEC_INTERNAL="\$(LIBMPDEC_HEADERS) \$(LIBMPDEC_A)"
4099+
have_mpdec=yes
4100+
with_system_libmpdec=no])
40954101
AC_ARG_WITH(
40964102
[system_libmpdec],
40974103
[AS_HELP_STRING(
40984104
[--with-system-libmpdec],
40994105
[build _decimal module using an installed mpdecimal library, see Doc/library/decimal.rst (default is yes)]
41004106
)],
4101-
[],
4107+
[AS_IF([test "x$with_system_libmpdec" = xno],
4108+
[USE_BUNDLED_LIBMPDEC()])],
41024109
[with_system_libmpdec="yes"])
41034110
AC_MSG_RESULT([$with_system_libmpdec])
41044111

4105-
AC_DEFUN([USE_BUNDLED_LIBMPDEC],
4106-
[LIBMPDEC_CFLAGS="-I\$(srcdir)/Modules/_decimal/libmpdec"
4107-
LIBMPDEC_LIBS="-lm \$(LIBMPDEC_A)"
4108-
LIBMPDEC_INTERNAL="\$(LIBMPDEC_HEADERS) \$(LIBMPDEC_A)"
4109-
have_mpdec=yes
4110-
with_system_libmpdec=no])
4111-
41124112
AS_VAR_IF(
41134113
[with_system_libmpdec], [yes],
41144114
[PKG_CHECK_MODULES(
41154115
[LIBMPDEC], [libmpdec >= 2.5.0], [],
41164116
[LIBMPDEC_CFLAGS=${LIBMPDEC_CFLAGS-""}
41174117
LIBMPDEC_LIBS=${LIBMPDEC_LIBS-"-lmpdec -lm"}
4118-
LIBMPDEC_INTERNAL=])],
4119-
[USE_BUNDLED_LIBMPDEC()])
4118+
LIBMPDEC_INTERNAL=])])
41204119

41214120
AS_VAR_IF([with_system_libmpdec], [yes],
41224121
[WITH_SAVE_ENV([
@@ -4132,16 +4131,17 @@ AS_VAR_IF([with_system_libmpdec], [yes],
41324131
], [const char *x = mpd_version();])],
41334132
[have_mpdec=yes],
41344133
[have_mpdec=no])
4135-
])],
4136-
[AC_MSG_WARN([m4_normalize([
4134+
])])
4135+
AS_VAR_IF([with_system_libmpdec], [no],
4136+
[AC_MSG_WARN([m4_normalize([
41374137
the bundled copy of libmpdecimal is scheduled for removal in Python 3.16;
41384138
consider using a system installed mpdecimal library.])])])
41394139

41404140
AS_IF([test "$with_system_libmpdec" = "yes" && test "$have_mpdec" = "no"],
41414141
[AC_MSG_WARN([m4_normalize([
4142-
no system libmpdecimal found; falling back to bundled libmpdecimal
4143-
(deprecated and scheduled for removal in Python 3.16)])])
4144-
USE_BUNDLED_LIBMPDEC()])
4142+
no system libmpdecimal found; falling back to pure-Python version
4143+
for the decimal module])])
4144+
AS_VAR_SET([py_cv_module_]_decimal, [n/a])])
41454145

41464146
# Disable forced inlining in debug builds, see GH-94847
41474147
AS_VAR_IF(

0 commit comments

Comments
 (0)