FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

[3.15] gh-152870: Fix compile error with decimal when EXTRA_FUNCTIONALITY enabled (GH-152871) by miss-islington · Pull Request #152937 · python/cpython · GitHub

Repository navigation

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .c  (1) .py  (1) .rst  (1) All 3 file types selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
8 changes: 8 additions & 0 deletions Lib/test/test_decimal.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -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.
2 changes: 1 addition & 1 deletion Modules/_decimal/_decimal.c
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Loading

Back | FazBrowse Home | New Git URL