Skip to content

gh-73487: Convert _decimal to use Argument Clinic (part 2) #137637

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 23 commits into
base: main
Choose a base branch
from
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Apply suggestions from code review
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
  • Loading branch information
skirpichev and AA-Turner authored Aug 11, 2025
commit 2c53b4869eb194378346f2de26fd2d079076e7fc
6 changes: 4 additions & 2 deletions Modules/_decimal/_decimal.c
Original file line number Diff line number Diff line change
Expand Up @@ -2912,7 +2912,8 @@ _decimal_Decimal_from_float_impl(PyTypeObject *type, PyObject *pyfloat)
CURRENT_CONTEXT(state, context);
result = PyDecType_FromFloatExact(state->PyDec_Type, pyfloat, context);
if (type != state->PyDec_Type && result != NULL) {
Py_SETREF(result, PyObject_CallFunctionObjArgs((PyObject *)type, result, NULL));
Py_SETREF(result,
PyObject_CallFunctionObjArgs((PyObject *)type, result, NULL));
}

return result;
Expand Down Expand Up @@ -2976,7 +2977,8 @@ _decimal_Decimal_from_number_impl(PyTypeObject *type, PyObject *number)
CURRENT_CONTEXT(state, context);
result = PyDecType_FromNumberExact(state->PyDec_Type, number, context);
if (type != state->PyDec_Type && result != NULL) {
Py_SETREF(result, PyObject_CallFunctionObjArgs((PyObject *)type, result, NULL));
Py_SETREF(result,
PyObject_CallFunctionObjArgs((PyObject *)type, result, NULL));
}

return result;
Expand Down
Loading