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
--- /dev/null
+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.
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