Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
c8b8a57
gh-115119: Removed bundled copy of the libmpdec
skirpichev May 13, 2025
43c8721
+ configure
skirpichev May 13, 2025
9d6c9b5
+1
skirpichev May 13, 2025
5de2aa2
Apply suggestions from code review
skirpichev May 13, 2025
dfd9f40
+ configure
skirpichev May 13, 2025
769a36a
autoconf
AA-Turner May 13, 2025
60f7ae2
revert
AA-Turner May 13, 2025
b9af863
makesetup
AA-Turner May 13, 2025
81c7020
+ lint and macos
skirpichev May 13, 2025
3bf12e8
Windows: SBOM
AA-Turner May 13, 2025
4555447
lint
AA-Turner May 13, 2025
2fca0e5
fix docs
skirpichev May 14, 2025
800dd01
XXX disable _decimal if no libmpdec is available
skirpichev May 14, 2025
be3d413
+1
skirpichev May 14, 2025
bd03679
fix json
skirpichev May 14, 2025
2ba6b8b
reorder
skirpichev May 14, 2025
8bc2e53
install libmpdec on this job
skirpichev May 14, 2025
a79e284
Merge branch 'main' into remove-bundled-mpdecimal/115119
skirpichev Jun 3, 2025
f0dc0bb
XXX try libmpdec-dev from PPA for PHP: https://launchpad.net/~ondrej/…
skirpichev Jun 3, 2025
6e74feb
+1
skirpichev Jun 3, 2025
a4a6796
Merge branch 'master' into remove-bundled-mpdecimal/115119
skirpichev May 8, 2026
e0bdb87
news
skirpichev May 8, 2026
adf7af4
+1
skirpichev May 8, 2026
9ccd488
+1
skirpichev May 8, 2026
e10ed83
Apply suggestions from code review
skirpichev May 9, 2026
b2f5f30
address review: restore license.rst
skirpichev May 9, 2026
081d1e0
address review: revert unrelated change
skirpichev May 9, 2026
97767d6
address review: cleanup configure.ac
skirpichev May 9, 2026
57bd0b0
Merge branch 'main' into remove-bundled-mpdecimal/115119
skirpichev May 11, 2026
fa0d506
Merge branch 'master' into remove-bundled-mpdecimal/115119
skirpichev May 12, 2026
0cab465
address review: move news
skirpichev May 12, 2026
f4a1b18
address review: trying to reword license.rst
skirpichev May 12, 2026
11867cd
address review: cleanup Modules/_decimal/README.txt
skirpichev May 12, 2026
0e3afd7
address review: set module missing, if have_mpdec==no
skirpichev May 12, 2026
0dd4a29
Apply suggestions from code review
skirpichev May 12, 2026
59a7986
address review: configure.ac cleanup
skirpichev May 12, 2026
c1e262a
Merge branch 'master' into remove-bundled-mpdecimal/115119
skirpichev May 12, 2026
b4cc60d
Apply suggestions from code review
zware May 12, 2026
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
1 change: 0 additions & 1 deletion Doc/deprecations/c-api-pending-removal-in-3.15.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
Pending removal in Python 3.15
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

* The bundled copy of ``libmpdecimal``.
* The :c:func:`!PyImport_ImportModuleNoBlock`:
Use :c:func:`PyImport_ImportModule` instead.
* :c:func:`PyWeakref_GetObject` and :c:func:`PyWeakref_GET_OBJECT`:
Expand Down
33 changes: 0 additions & 33 deletions Doc/license.rst
Original file line number Diff line number Diff line change
Expand Up @@ -975,39 +975,6 @@ on the cfuhash project::
OF THE POSSIBILITY OF SUCH DAMAGE.


libmpdec
Comment thread
skirpichev marked this conversation as resolved.
--------

The :mod:`!_decimal` C extension underlying the :mod:`decimal` module
is built using an included copy of the libmpdec
library unless the build is configured ``--with-system-libmpdec``::

Copyright (c) 2008-2020 Stefan Krah. All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:

1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.


W3C C14N test suite
-------------------

Expand Down
21 changes: 0 additions & 21 deletions Doc/using/configure.rst
Original file line number Diff line number Diff line change
Expand Up @@ -416,11 +416,6 @@ Options for third-party dependencies
C compiler and linker flags for ``libmpdec``, used by :mod:`decimal` module,
overriding ``pkg-config``.

.. note::

These environment variables have no effect unless
:option:`--with-system-libmpdec` is specified.

.. option:: LIBLZMA_CFLAGS
.. option:: LIBLZMA_LIBS

Expand Down Expand Up @@ -835,22 +830,6 @@ Libraries options
Build the :mod:`!pyexpat` module using an installed ``expat`` library
(default is no).

.. option:: --with-system-libmpdec

Build the ``_decimal`` extension module using an installed ``mpdecimal``
library, see the :mod:`decimal` module (default is yes).

.. versionadded:: 3.3

.. versionchanged:: 3.13
Default to using the installed ``mpdecimal`` library.

.. deprecated-removed:: 3.13 3.15
A copy of the ``mpdecimal`` library sources will no longer be distributed
with Python 3.15.

.. seealso:: :option:`LIBMPDEC_CFLAGS` and :option:`LIBMPDEC_LIBS`.
Comment thread
skirpichev marked this conversation as resolved.

.. option:: --with-readline=readline|editline

Designate a backend library for the :mod:`readline` module.
Expand Down
2 changes: 1 addition & 1 deletion Doc/whatsnew/3.13.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2575,7 +2575,7 @@ Build Changes

.. _mimalloc library: https://github.com/microsoft/mimalloc/

* The :file:`configure` option :option:`--with-system-libmpdec`
* The :file:`configure` option ``--with-system-libmpdec``
Comment thread
skirpichev marked this conversation as resolved.
Outdated
now defaults to ``yes``.
The bundled copy of ``libmpdecimal`` will be removed in Python 3.15.

Expand Down
4 changes: 4 additions & 0 deletions Doc/whatsnew/3.15.rst
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,10 @@ that may require changes to your code.
Build changes
=============

* Removed bundled copy of the libmpdec, use system library if it's
available.
Comment thread
skirpichev marked this conversation as resolved.
Outdated
(Contributed by Sergey B Kirpichev in :gh:`115119`.)


C API changes
=============
Expand Down
1 change: 0 additions & 1 deletion Mac/BuildScript/build-installer.py
Original file line number Diff line number Diff line change
Expand Up @@ -1158,7 +1158,6 @@ def buildPython():
print(" NOTE: --with-mimalloc=no pending resolution of weak linking issues")
runCommand("%s -C --enable-framework --enable-universalsdk=/ "
"--with-mimalloc=no "
"--with-system-libmpdec "
"--with-universal-archs=%s "
"%s "
"%s "
Expand Down
95 changes: 0 additions & 95 deletions Makefile.pre.in
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,6 @@ RUNSHARED= @RUNSHARED@
ENSUREPIP= @ENSUREPIP@

# Internal static libraries
LIBMPDEC_A= Modules/_decimal/libmpdec/libmpdec.a
LIBEXPAT_A= Modules/expat/libexpat.a

# HACL* build configuration
Expand Down Expand Up @@ -589,45 +588,6 @@ LINK_PYTHON_OBJS=@LINK_PYTHON_OBJS@
DTRACE_DEPS = \
Python/ceval.o Python/gc.o Python/import.o Python/sysmodule.o

##########################################################################
# decimal's libmpdec

LIBMPDEC_OBJS= \
Modules/_decimal/libmpdec/basearith.o \
Modules/_decimal/libmpdec/constants.o \
Modules/_decimal/libmpdec/context.o \
Modules/_decimal/libmpdec/convolute.o \
Modules/_decimal/libmpdec/crt.o \
Modules/_decimal/libmpdec/difradix2.o \
Modules/_decimal/libmpdec/fnt.o \
Modules/_decimal/libmpdec/fourstep.o \
Modules/_decimal/libmpdec/io.o \
Modules/_decimal/libmpdec/mpalloc.o \
Modules/_decimal/libmpdec/mpdecimal.o \
Modules/_decimal/libmpdec/numbertheory.o \
Modules/_decimal/libmpdec/sixstep.o \
Modules/_decimal/libmpdec/transpose.o
# _decimal does not use signaling API
# Modules/_decimal/libmpdec/mpsignal.o

LIBMPDEC_HEADERS= \
$(srcdir)/Modules/_decimal/libmpdec/basearith.h \
$(srcdir)/Modules/_decimal/libmpdec/bits.h \
$(srcdir)/Modules/_decimal/libmpdec/constants.h \
$(srcdir)/Modules/_decimal/libmpdec/convolute.h \
$(srcdir)/Modules/_decimal/libmpdec/crt.h \
$(srcdir)/Modules/_decimal/libmpdec/difradix2.h \
$(srcdir)/Modules/_decimal/libmpdec/fnt.h \
$(srcdir)/Modules/_decimal/libmpdec/fourstep.h \
$(srcdir)/Modules/_decimal/libmpdec/io.h \
$(srcdir)/Modules/_decimal/libmpdec/mpalloc.h \
$(srcdir)/Modules/_decimal/libmpdec/mpdecimal.h \
$(srcdir)/Modules/_decimal/libmpdec/numbertheory.h \
$(srcdir)/Modules/_decimal/libmpdec/sixstep.h \
$(srcdir)/Modules/_decimal/libmpdec/transpose.h \
$(srcdir)/Modules/_decimal/libmpdec/typearith.h \
$(srcdir)/Modules/_decimal/libmpdec/umodarith.h

##########################################################################
# pyexpat's expat library

Expand Down Expand Up @@ -945,7 +905,6 @@ coverage-lcov:
@lcov $(COVERAGE_LCOV_OPTIONS) --remove $(COVERAGE_INFO) \
'*/Modules/_hacl/*' \
'*/Modules/_ctypes/libffi*/*' \
'*/Modules/_decimal/libmpdec/*' \
'*/Modules/expat/*' \
'*/Modules/xx*.c' \
'*/Python/pyfpe.c' \
Expand Down Expand Up @@ -1409,60 +1368,6 @@ PYTHON_HEADERS= \
\
$(srcdir)/Python/stdlib_module_names.h

##########################################################################
# Build static libmpdec.a
LIBMPDEC_CFLAGS=@LIBMPDEC_CFLAGS@ $(PY_STDMODULE_CFLAGS) $(CCSHARED)

# "%.o: %c" is not portable
Modules/_decimal/libmpdec/basearith.o: $(srcdir)/Modules/_decimal/libmpdec/basearith.c $(LIBMPDEC_HEADERS) $(PYTHON_HEADERS)
$(CC) -c $(LIBMPDEC_CFLAGS) -o $@ $(srcdir)/Modules/_decimal/libmpdec/basearith.c

Modules/_decimal/libmpdec/constants.o: $(srcdir)/Modules/_decimal/libmpdec/constants.c $(LIBMPDEC_HEADERS) $(PYTHON_HEADERS)
$(CC) -c $(LIBMPDEC_CFLAGS) -o $@ $(srcdir)/Modules/_decimal/libmpdec/constants.c

Modules/_decimal/libmpdec/context.o: $(srcdir)/Modules/_decimal/libmpdec/context.c $(LIBMPDEC_HEADERS) $(PYTHON_HEADERS)
$(CC) -c $(LIBMPDEC_CFLAGS) -o $@ $(srcdir)/Modules/_decimal/libmpdec/context.c

Modules/_decimal/libmpdec/convolute.o: $(srcdir)/Modules/_decimal/libmpdec/convolute.c $(LIBMPDEC_HEADERS) $(PYTHON_HEADERS)
$(CC) -c $(LIBMPDEC_CFLAGS) -o $@ $(srcdir)/Modules/_decimal/libmpdec/convolute.c

Modules/_decimal/libmpdec/crt.o: $(srcdir)/Modules/_decimal/libmpdec/crt.c $(LIBMPDEC_HEADERS) $(PYTHON_HEADERS)
$(CC) -c $(LIBMPDEC_CFLAGS) -o $@ $(srcdir)/Modules/_decimal/libmpdec/crt.c

Modules/_decimal/libmpdec/difradix2.o: $(srcdir)/Modules/_decimal/libmpdec/difradix2.c $(LIBMPDEC_HEADERS) $(PYTHON_HEADERS)
$(CC) -c $(LIBMPDEC_CFLAGS) -o $@ $(srcdir)/Modules/_decimal/libmpdec/difradix2.c

Modules/_decimal/libmpdec/fnt.o: $(srcdir)/Modules/_decimal/libmpdec/fnt.c $(LIBMPDEC_HEADERS) $(PYTHON_HEADERS)
$(CC) -c $(LIBMPDEC_CFLAGS) -o $@ $(srcdir)/Modules/_decimal/libmpdec/fnt.c

Modules/_decimal/libmpdec/fourstep.o: $(srcdir)/Modules/_decimal/libmpdec/fourstep.c $(LIBMPDEC_HEADERS) $(PYTHON_HEADERS)
$(CC) -c $(LIBMPDEC_CFLAGS) -o $@ $(srcdir)/Modules/_decimal/libmpdec/fourstep.c

Modules/_decimal/libmpdec/io.o: $(srcdir)/Modules/_decimal/libmpdec/io.c $(LIBMPDEC_HEADERS) $(PYTHON_HEADERS)
$(CC) -c $(LIBMPDEC_CFLAGS) -o $@ $(srcdir)/Modules/_decimal/libmpdec/io.c

Modules/_decimal/libmpdec/mpalloc.o: $(srcdir)/Modules/_decimal/libmpdec/mpalloc.c $(LIBMPDEC_HEADERS) $(PYTHON_HEADERS)
$(CC) -c $(LIBMPDEC_CFLAGS) -o $@ $(srcdir)/Modules/_decimal/libmpdec/mpalloc.c

Modules/_decimal/libmpdec/mpdecimal.o: $(srcdir)/Modules/_decimal/libmpdec/mpdecimal.c $(LIBMPDEC_HEADERS) $(PYTHON_HEADERS)
$(CC) -c $(LIBMPDEC_CFLAGS) -o $@ $(srcdir)/Modules/_decimal/libmpdec/mpdecimal.c

Modules/_decimal/libmpdec/mpsignal.o: $(srcdir)/Modules/_decimal/libmpdec/mpsignal.c $(LIBMPDEC_HEADERS) $(PYTHON_HEADERS)
$(CC) -c $(LIBMPDEC_CFLAGS) -o $@ $(srcdir)/Modules/_decimal/libmpdec/mpsignal.c

Modules/_decimal/libmpdec/numbertheory.o: $(srcdir)/Modules/_decimal/libmpdec/numbertheory.c $(LIBMPDEC_HEADERS) $(PYTHON_HEADERS)
$(CC) -c $(LIBMPDEC_CFLAGS) -o $@ $(srcdir)/Modules/_decimal/libmpdec/numbertheory.c

Modules/_decimal/libmpdec/sixstep.o: $(srcdir)/Modules/_decimal/libmpdec/sixstep.c $(LIBMPDEC_HEADERS) $(PYTHON_HEADERS)
$(CC) -c $(LIBMPDEC_CFLAGS) -o $@ $(srcdir)/Modules/_decimal/libmpdec/sixstep.c

Modules/_decimal/libmpdec/transpose.o: $(srcdir)/Modules/_decimal/libmpdec/transpose.c $(LIBMPDEC_HEADERS) $(PYTHON_HEADERS)
$(CC) -c $(LIBMPDEC_CFLAGS) -o $@ $(srcdir)/Modules/_decimal/libmpdec/transpose.c

$(LIBMPDEC_A): $(LIBMPDEC_OBJS)
-rm -f $@
$(AR) $(ARFLAGS) $@ $(LIBMPDEC_OBJS)

##########################################################################
# Build static libexpat.a
LIBEXPAT_CFLAGS=@LIBEXPAT_CFLAGS@ $(PY_STDMODULE_CFLAGS) $(CCSHARED)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Removed bundled copy of the libmpdec, use system library if it's available.
Patch by Sergey B Kirpichev.
Loading