| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -4967,6 +4967,14 @@ def test_c_context(self): | |||
| 4967 | 4967 | self.assertEqual(c._flags, C.DecClamped) | |
| 4968 | 4968 | self.assertEqual(c._traps, C.DecRounded) | |
| 4969 | 4969 | ||
| 4970 | + @requires_extra_functionality | ||
| 4971 | + def test_c_context_apply(self): | ||
| 4972 | + c = C.Context(prec=3) | ||
| 4973 | + self.assertEqual(c.apply(C.Decimal('1.23456')), C.Decimal('1.23')) | ||
| 4974 | + # A higher precision won't see them as equal. | ||
| 4975 | + c = C.Context(prec=5) | ||
| 4976 | + self.assertNotEqual(c.apply(C.Decimal('1.23456')), C.Decimal('1.23')) | ||
| 4977 | + | ||
| 4970 | 4978 | @requires_extra_functionality | |
| 4971 | 4979 | def test_constants(self): | |
| 4972 | 4980 | # Condition flags | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,4 @@ | |||
| 1 | + Fix a compilation error in the :mod:`decimal` C extension (``_decimal``) when | ||
| 2 | + it is built with ``EXTRA_FUNCTIONALITY``. ``Context.apply()`` called the | ||
| 3 | + internal ``_apply`` helper using its pre-Argument-Clinic signature; the call is | ||
| 4 | + now made through the generated ``_impl`` function. | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -6993,7 +6993,7 @@ _decimal_Context_apply_impl(PyObject *context, PyTypeObject *cls, | |||
| 6993 | 6993 | PyObject *x) | |
| 6994 | 6994 | /*[clinic end generated code: output=f8a7142d47ad4ff3 input=388e66ca82733516]*/ | |
| 6995 | 6995 | { | |
| 6996 | - return _decimal_Context__apply(context, x); | ||
| 6996 | + return _decimal_Context__apply_impl(context, cls, x); | ||
| 6997 | 6997 | } | |
| 6998 | 6998 | #endif | |
| 6999 | 6999 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments