[3.15] gh-152870: Fix compile error with decimal when EXTRA_FUNCTIONALITY enabled (GH-152871) (#152937)

gh-152870: Fix compile error with decimal when EXTRA_FUNCTIONALITY enabled (GH-152871)
(cherry picked from commit c4739533f3)

Co-authored-by: Xiaowei Lu <weixlu420302@gmail.com>
This commit is contained in:
Miss Islington (bot)
2026-07-03 13:03:07 +02:00
committed by GitHub
parent 1b89ad7e00
commit 2a7eb3d179
3 changed files with 13 additions and 1 deletions
+8
View File
@@ -4967,6 +4967,14 @@ class CFunctionality(unittest.TestCase):
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
@@ -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.
+1 -1
View File
@@ -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