8000 gh-115119: Removed bundled copy of the libmpdec by skirpichev · Pull Request #133964 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-115119: Removed bundled copy of the libmpdec #133964

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

Draft
wants to merge 20 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 5 commits
Commits
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
--------

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

.. 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 :option:!--with-system-libmpdec`
now defaults to ``yes``.
The bundled copy of ``libmpdecimal`` will be removed in Python 3.15.

Expand Down
8 changes: 8 additions & 0 deletions Doc/whatsnew/3.15.rst
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,14 @@
Build changes
=============

* Remove the bundled libmpdec_ decimal library from the CPython source tree,
to simplify maintenence and updates. The :mod:`decimal` module will now
unconditionally use the system's libmpdec decimal library. Also remove the
now unused :option:`!--with-system-libmpdec` :program:`configure` flag.

.. _libmpdec: https://www.bytereef.org/mpdecimal/
(Contributed by Sergey B Kirpichev in :gh:`115119`.)

Check warning on line 163 in Doc/whatsnew/3.15.rst

View workflow job for this annotation

GitHub Actions / Docs / Docs

Explicit markup ends without a blank line; unexpected unindent. [docutils]


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
2851
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
Loading
0