Skip to content
Merged
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
add _dec_mpd_radix()
  • Loading branch information
neonene committed Sep 27, 2024
commit 818c24fd2c96d8e1494528397a72c14352be5bd6
15 changes: 11 additions & 4 deletions Modules/_decimal/_decimal.c
Original file line number Diff line number Diff line change
Expand Up @@ -4433,12 +4433,11 @@ dec_conjugate(PyObject *self, PyObject *Py_UNUSED(dummy))
return Py_NewRef(self);
}

static PyObject *
dec_mpd_radix(PyObject *self, PyObject *Py_UNUSED(dummy))
static inline PyObject *
_dec_mpd_radix(decimal_state *state)
{
PyObject *result;

decimal_state *state = get_module_state_by_def(Py_TYPE(self));
result = dec_alloc(state);
if (result == NULL) {
return NULL;
Expand All @@ -4448,6 +4447,13 @@ dec_mpd_radix(PyObject *self, PyObject *Py_UNUSED(dummy))
return result;
}

static PyObject *
dec_mpd_radix(PyObject *self, PyObject *Py_UNUSED(dummy))
{
decimal_state *state = get_module_state_by_def(Py_TYPE(self));
return _dec_mpd_radix(state);
}

static PyObject *
dec_mpd_qcopy_abs(PyObject *self, PyObject *Py_UNUSED(dummy))
{
Expand Down Expand Up @@ -5403,7 +5409,8 @@ DecCtx_TernaryFunc(mpd_qfma)
static PyObject *
ctx_mpd_radix(PyObject *context, PyObject *dummy)
{
return dec_mpd_radix(context, dummy);
decimal_state *state = get_module_state_from_ctx(context);
return _dec_mpd_radix(state);
}

/* Boolean functions: single decimal argument */
Expand Down