Skip to content

Commit 94537e1

Browse files
committed
+2
1 parent d3f8428 commit 94537e1

File tree

3 files changed

+93
-21
lines changed

3 files changed

+93
-21
lines changed

Modules/_decimal/_decimal.c

Lines changed: 30 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,34 @@ 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+
self as context: self
6946+
x: object
6947+
y: object
6948+
/
6949+
6950+
Compare x and y using their abstract representation.
6951+
[clinic start generated code]*/
6952+
6953+
static PyObject *
6954+
_decimal_Context_compare_total_impl(PyObject *context, PyObject *x,
6955+
PyObject *y)
6956+
/*[clinic end generated code: output=a9299ef125fb2245 input=020b30c9bc2ea2c6]*/
69486957
DecCtx_BinaryFunc_NO_CTX(mpd_compare_total)
6958+
6959+
/*[clinic input]
6960+
_decimal.Context.compare_total_mag = _decimal.Context.compare_total
6961+
6962+
Compare x and y using their abstract representation, ignoring sign.
6963+
[clinic start generated code]*/
6964+
6965+
static PyObject *
6966+
_decimal_Context_compare_total_mag_impl(PyObject *context, PyObject *x,
6967+
PyObject *y)
6968+
/*[clinic end generated code: output=7c376de9f94feeaf input=2b982e69f932dcb2]*/
69496969
DecCtx_BinaryFunc_NO_CTX(mpd_compare_total_mag)
69506970

69516971
static PyObject *
@@ -7143,8 +7163,8 @@ static PyMethodDef context_methods [] =
71437163
{ "to_eng_string", ctx_mpd_to_eng, METH_O, doc_ctx_to_eng_string },
71447164

71457165
/* 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 },
7166+
_DECIMAL_CONTEXT_COMPARE_TOTAL_METHODDEF
7167+
_DECIMAL_CONTEXT_COMPARE_TOTAL_MAG_METHODDEF
71487168
{ "copy_sign", ctx_mpd_qcopy_sign, METH_VARARGS, doc_ctx_copy_sign },
71497169
_DECIMAL_CONTEXT_LOGICAL_AND_METHODDEF
71507170
_DECIMAL_CONTEXT_LOGICAL_OR_METHODDEF

Modules/_decimal/clinic/_decimal.c.h

Lines changed: 63 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)