Skip to content

Commit 5d9dee8

Browse files
committed
+2
1 parent d3f8428 commit 5d9dee8

File tree

3 files changed

+90
-21
lines changed

3 files changed

+90
-21
lines changed

Modules/_decimal/_decimal.c

Lines changed: 28 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6112,18 +6112,11 @@ static PyType_Spec dec_spec = {
61126112
* The actual MPDFUNC does NOT take a context arg.
61136113
*/
61146114
#define DecCtx_BinaryFunc_NO_CTX(MPDFUNC) \
6115-
static PyObject * \
6116-
ctx_##MPDFUNC(PyObject *context, PyObject *args) \
61176115
{ \
6118-
PyObject *v, *w; \
61196116
PyObject *a, *b; \
61206117
PyObject *result; \
61216118
\
6122-
if (!PyArg_ParseTuple(args, "OO", &v, &w)) { \
6123-
return NULL; \
6124-
} \
6125-
\
6126-
CONVERT_BINOP_RAISE(&a, &b, v, w, context); \
6119+
CONVERT_BINOP_RAISE(&a, &b, x, y, context); \
61276120
decimal_state *state = \
61286121
get_module_state_from_ctx(context); \
61296122
if ((result = dec_alloc(state)) == NULL) { \
@@ -6945,7 +6938,32 @@ ctx_mpd_to_eng(PyObject *context, PyObject *v)
69456938
}
69466939

69476940
/* Functions with two decimal arguments */
6941+
6942+
/*[clinic input]
6943+
_decimal.Context.compare_total
6944+
6945+
x: object
6946+
y: object
6947+
/
6948+
6949+
Compare x and y using their abstract representation.
6950+
[clinic start generated code]*/
6951+
6952+
static PyObject *
6953+
_decimal_Context_compare_total_impl(PyObject *self, PyObject *x, PyObject *y)
6954+
/*[clinic end generated code: output=c8b3bc8c2db253c3 input=17d5df4a130712e7]*/
69486955
DecCtx_BinaryFunc_NO_CTX(mpd_compare_total)
6956+
6957+
/*[clinic input]
6958+
_decimal.Context.compare_total_mag = _decimal.Context.compare_total
6959+
6960+
Compare x and y using their abstract representation, ignoring sign.
6961+
[clinic start generated code]*/
6962+
6963+
static PyObject *
6964+
_decimal_Context_compare_total_mag_impl(PyObject *self, PyObject *x,
6965+
PyObject *y)
6966+
/*[clinic end generated code: output=725b7209e0897ac6 input=2b982e69f932dcb2]*/
69496967
DecCtx_BinaryFunc_NO_CTX(mpd_compare_total_mag)
69506968

69516969
static PyObject *
@@ -7143,8 +7161,8 @@ static PyMethodDef context_methods [] =
71437161
{ "to_eng_string", ctx_mpd_to_eng, METH_O, doc_ctx_to_eng_string },
71447162

71457163
/* Functions with two decimal arguments */
7146-
{ "compare_total", ctx_mpd_compare_total, METH_VARARGS, doc_ctx_compare_total },
7147-
{ "compare_total_mag", ctx_mpd_compare_total_mag, METH_VARARGS, doc_ctx_compare_total_mag },
7164+
_DECIMAL_CONTEXT_COMPARE_TOTAL_METHODDEF
7165+
_DECIMAL_CONTEXT_COMPARE_TOTAL_MAG_METHODDEF
71487166
{ "copy_sign", ctx_mpd_qcopy_sign, METH_VARARGS, doc_ctx_copy_sign },
71497167
_DECIMAL_CONTEXT_LOGICAL_AND_METHODDEF
71507168
_DECIMAL_CONTEXT_LOGICAL_OR_METHODDEF

Modules/_decimal/clinic/_decimal.c.h

Lines changed: 62 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Modules/_decimal/docstrings.h

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -72,16 +72,6 @@ PyDoc_STRVAR(doc_ctx_canonical,
7272
Return a new instance of x.\n\
7373
\n");
7474

75-
PyDoc_STRVAR(doc_ctx_compare_total,
76-
"compare_total($self, x, y, /)\n--\n\n\
77-
Compare x and y using their abstract representation.\n\
78-
\n");
79-
80-
PyDoc_STRVAR(doc_ctx_compare_total_mag,
81-
"compare_total_mag($self, x, y, /)\n--\n\n\
82-
Compare x and y using their abstract representation, ignoring sign.\n\
83-
\n");
84-
8575
PyDoc_STRVAR(doc_ctx_copy_abs,
8676
"copy_abs($self, x, /)\n--\n\n\
8777
Return a copy of x with the sign set to 0.\n\

0 commit comments

Comments
 (0)