https://github.com/python/cpython/commit/c4739533f335f9cd4fa71ba6daff2a81751da643
commit: c4739533f335f9cd4fa71ba6daff2a81751da643
branch: main
author: Xiaowei Lu <[email protected]>
committer: sobolevn <[email protected]>
date: 2026-07-03T13:34:15+03:00
summary:
gh-152870: Fix compile error with decimal when EXTRA_FUNCTIONALITY enabled
(#152871)
files:
A Misc/NEWS.d/next/Build/2026-07-02-16-25-13.gh-issue-152870.oh9eD1.rst
M Lib/test/test_decimal.py
M Modules/_decimal/_decimal.c
diff --git a/Lib/test/test_decimal.py b/Lib/test/test_decimal.py
index fe8c8ce12da0bfa..a04ed0c83c07c4a 100644
--- a/Lib/test/test_decimal.py
+++ b/Lib/test/test_decimal.py
@@ -4967,6 +4967,14 @@ def test_c_context(self):
self.assertEqual(c._flags, C.DecClamped)
self.assertEqual(c._traps, C.DecRounded)
+ @requires_extra_functionality
+ def test_c_context_apply(self):
+ c = C.Context(prec=3)
+ self.assertEqual(c.apply(C.Decimal('1.23456')), C.Decimal('1.23'))
+ # A higher precision won't see them as equal.
+ c = C.Context(prec=5)
+ self.assertNotEqual(c.apply(C.Decimal('1.23456')), C.Decimal('1.23'))
+
@requires_extra_functionality
def test_constants(self):
# Condition flags
diff --git
a/Misc/NEWS.d/next/Build/2026-07-02-16-25-13.gh-issue-152870.oh9eD1.rst
b/Misc/NEWS.d/next/Build/2026-07-02-16-25-13.gh-issue-152870.oh9eD1.rst
new file mode 100644
index 000000000000000..eaddd22a60fc09b
--- /dev/null
+++ b/Misc/NEWS.d/next/Build/2026-07-02-16-25-13.gh-issue-152870.oh9eD1.rst
@@ -0,0 +1,4 @@
+Fix a compilation error in the :mod:`decimal` C extension (``_decimal``) when
+it is built with ``EXTRA_FUNCTIONALITY``. ``Context.apply()`` called the
+internal ``_apply`` helper using its pre-Argument-Clinic signature; the call is
+now made through the generated ``_impl`` function.
diff --git a/Modules/_decimal/_decimal.c b/Modules/_decimal/_decimal.c
index 4db1b60be77844d..dc1b3c06bed9521 100644
--- a/Modules/_decimal/_decimal.c
+++ b/Modules/_decimal/_decimal.c
@@ -6993,7 +6993,7 @@ _decimal_Context_apply_impl(PyObject *context,
PyTypeObject *cls,
PyObject *x)
/*[clinic end generated code: output=f8a7142d47ad4ff3 input=388e66ca82733516]*/
{
- return _decimal_Context__apply(context, x);
+ return _decimal_Context__apply_impl(context, cls, x);
}
#endif
_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]