Skip to content

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

Open
skirpichev wants to merge 34 commits into
python:mainfrom
skirpichev:remove-bundled-mpdecimal/115119
Open

gh-115119: Removed bundled copy of the libmpdec#133964
skirpichev wants to merge 34 commits into
python:mainfrom
skirpichev:remove-bundled-mpdecimal/115119

Conversation

@skirpichev
Copy link
Copy Markdown
Member

@skirpichev skirpichev commented May 13, 2025

@bedevere-app bedevere-app Bot mentioned this pull request May 13, 2025
15 tasks
@skirpichev skirpichev force-pushed the remove-bundled-mpdecimal/115119 branch from 7cba56a to 9d6c9b5 Compare May 13, 2025 15:37
Copy link
Copy Markdown
Member

@AA-Turner AA-Turner left a comment

Choose a reason for hiding this comment

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

quick comments, haven't looked at build system changes

Comment thread Doc/using/configure.rst
Comment thread Doc/whatsnew/3.13.rst Outdated
Comment thread Doc/whatsnew/3.15.rst Outdated
Comment thread Misc/sbom.spdx.json Outdated
Comment thread Modules/Setup.stdlib.in Outdated
skirpichev and others added 2 commits May 13, 2025 19:21
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
zware
zware previously requested changes May 13, 2025
Comment thread PCbuild/_decimal.vcxproj.filters
@bedevere-app

This comment was marked as resolved.

@AA-Turner

This comment was marked as resolved.

@skirpichev

This comment was marked as resolved.

@bedevere-app

This comment was marked as resolved.

@bedevere-app bedevere-app Bot requested a review from zware May 14, 2025 03:41
@skirpichev

This comment was marked as resolved.

@skirpichev skirpichev force-pushed the remove-bundled-mpdecimal/115119 branch from 0a33f9f to 2ba6b8b Compare May 14, 2025 05:49
Copy link
Copy Markdown
Member

@ned-deily ned-deily left a comment

Choose a reason for hiding this comment

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

Mac/Buildscript/build-installer.py change LGTM

Comment thread .github/workflows/posix-deps-apt.sh Outdated
Comment thread Doc/whatsnew/3.16.rst Outdated
* 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.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We should probably mention that binary distributions will still include the _decimal module with libmpdec compiled in.

Comment thread Doc/whatsnew/3.16.rst Outdated
Comment thread Doc/license.rst
decimal.so is not built from a static libmpdec.a since doing so led to
failures on AIX (user report) and Windows (mixing static and dynamic CRTs
causes locale problems and more).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nit: most of this is out of date, and there are more extra blank lines at the top of the file.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Are you OK with removal of this?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Either removal or paring it back to just the About section would be my preference.

Copy link
Copy Markdown
Member

@zware zware May 11, 2026

Choose a reason for hiding this comment

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

There's also a Modules/_decimal/windows/ directory to remove, and arguably Modules/_decimal/tests/. Scratch that, we still use Modules/_decimal/windows/mpdecimal.h. Still on the fence about tests/, though.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Still on the fence about tests/, though.

Why? We don't have any tests for the decimal module in th pybenchmark. Yet, have severe regressions since 3.9+. I don't think that removal of tests is a good idea.

At least, that should go to another pr.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

As far as I can tell, these tests are not run by regrtest and are mostly relevant to libmpdec rather than _decimal. I mostly just don't see why they're here. If they're important enough to keep, they're important enough to wire into regrtest.

Comment thread Modules/makesetup Outdated
Comment thread configure.ac Outdated
Comment thread configure.ac Outdated
Comment thread configure.ac Outdated
Comment thread configure.ac
@skirpichev skirpichev requested a review from zware May 9, 2026 05:59
Copy link
Copy Markdown
Contributor

@sethmlarson sethmlarson left a comment

Choose a reason for hiding this comment

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

Reviewed the changes to sbom.spdx.json and generate_sbom.py and those changes LGTM.

Copy link
Copy Markdown
Member

@zware zware left a comment

Choose a reason for hiding this comment

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

Quite close, I think, just a few more cleanups.

Comment thread Doc/license.rst
Comment thread Doc/tools/removed-ids.txt
Comment thread Doc/whatsnew/3.16.rst Outdated
decimal.so is not built from a static libmpdec.a since doing so led to
failures on AIX (user report) and Windows (mixing static and dynamic CRTs
causes locale problems and more).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Either removal or paring it back to just the About section would be my preference.

Comment thread configure.ac
decimal.so is not built from a static libmpdec.a since doing so led to
failures on AIX (user report) and Windows (mixing static and dynamic CRTs
causes locale problems and more).

Copy link
Copy Markdown
Member

@zware zware May 11, 2026

Choose a reason for hiding this comment

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

There's also a Modules/_decimal/windows/ directory to remove, and arguably Modules/_decimal/tests/. Scratch that, we still use Modules/_decimal/windows/mpdecimal.h. Still on the fence about tests/, though.

@skirpichev skirpichev requested a review from zware May 12, 2026 04:07
Comment thread Doc/whatsnew/3.16.rst
* Remove the bundled copy of the 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.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This could still use a note to the following effect:

Suggested change
now unused :option:`!--with-system-libmpdec` :program:`configure` flag.
now unused :option:`!--with-system-libmpdec` :program:`configure` flag.
This change has no impact on binary releases of Python, which have been
built against a separate copy of libmpdec for the past several releases.

Comment thread Doc/license.rst
Comment on lines +962 to 964
Previously, the :mod:`!_decimal` C extension underlying the :mod:`decimal` module
was built using an included copy of the libmpdec
library unless the build is configured ``--with-system-libmpdec``::
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Wouldn't hurt to fix the libffi section as well. Suggested wording here, though:

Suggested change
Previously, the :mod:`!_decimal` C extension underlying the :mod:`decimal` module
was built using an included copy of the libmpdec
library unless the build is configured ``--with-system-libmpdec``::
The :mod:`!_decimal` C extension underlying the :mod:`decimal` module
is linked to the libmpdec C library::

On the other hand, we could just leave this file alone for now and get someone more knowledgeable about such things to tell us what we should do in a separate issue :)

Comment thread configure.ac
Comment on lines +8283 to +8286
if test "$have_mpdec" = "no"
then
AS_VAR_SET([py_cv_module_]_decimal, [missing])
fi
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Not quite the change I meant; this whole check should be completely unnecessary:

Suggested change
if test "$have_mpdec" = "no"
then
AS_VAR_SET([py_cv_module_]_decimal, [missing])
fi

The PY_STDLIB_MOD macro below just does what's needed.

Comment thread configure.ac
# Disable forced inlining in debug builds, see GH-94847
AS_VAR_IF(
[with_pydebug], [yes],
[AS_VAR_APPEND([LIBMPDEC_CFLAGS], [" -DTEST_COVERAGE"])])
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is only relevant for building libmpdec itself, isn't it?

There is a usage of TEST_COVERAGE in Modules/_decimal/_decimal.c, but I don't see anything ever defining it for that module.

Comment thread configure.ac
[with_pydebug], [yes],
[AS_VAR_APPEND([LIBMPDEC_CFLAGS], [" -DTEST_COVERAGE"])])

AC_SUBST([LIBMPDEC_CFLAGS])
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why was this added?

decimal.so is not built from a static libmpdec.a since doing so led to
failures on AIX (user report) and Windows (mixing static and dynamic CRTs
causes locale problems and more).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

As far as I can tell, these tests are not run by regrtest and are mostly relevant to libmpdec rather than _decimal. I mostly just don't see why they're here. If they're important enough to keep, they're important enough to wire into regrtest.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants