|
63 | 63 | /*[clinic input]
|
64 | 64 | module _decimal
|
65 | 65 | class _decimal.Decimal "PyObject *" "&dec_spec"
|
| 66 | +class _decimal.Context "PyObject *" "&ctx_spec" |
66 | 67 | [clinic start generated code]*/
|
67 |
| -/*[clinic end generated code: output=da39a3ee5e6b4b0d input=e0e1f68f1f413f5f]*/ |
| 68 | +/*[clinic end generated code: output=da39a3ee5e6b4b0d input=8c3aa7cfde934d7b]*/ |
68 | 69 |
|
69 | 70 | struct PyDecContextObject;
|
70 | 71 | struct DecCondMap;
|
@@ -6369,6 +6370,70 @@ DecCtx_UnaryFunc(mpd_qround_to_int)
|
6369 | 6370 | DecCtx_UnaryFunc(mpd_qround_to_intx)
|
6370 | 6371 | DecCtx_UnaryFunc(mpd_qsqrt)
|
6371 | 6372 |
|
| 6373 | +/*[clinic input] |
| 6374 | +_decimal.Context.abs |
| 6375 | +
|
| 6376 | + x: object |
| 6377 | + / |
| 6378 | +
|
| 6379 | +Return the absolute value of x. |
| 6380 | +[clinic start generated code]*/ |
| 6381 | + |
| 6382 | +static PyObject * |
| 6383 | +_decimal_Context_abs(PyObject *self, PyObject *x) |
| 6384 | +/*[clinic end generated code: output=91c87f912542b183 input=2b69fea7e24c710f]*/ |
| 6385 | +{ |
| 6386 | + return ctx_mpd_qabs(self, x); |
| 6387 | +} |
| 6388 | + |
| 6389 | +/*[clinic input] |
| 6390 | +_decimal.Context.exp |
| 6391 | +
|
| 6392 | + x: object |
| 6393 | + / |
| 6394 | +
|
| 6395 | +Return e ** x. |
| 6396 | +[clinic start generated code]*/ |
| 6397 | + |
| 6398 | +static PyObject * |
| 6399 | +_decimal_Context_exp(PyObject *self, PyObject *x) |
| 6400 | +/*[clinic end generated code: output=f8d14995cc8c76e7 input=37f44653b0f7397e]*/ |
| 6401 | +{ |
| 6402 | + return ctx_mpd_qexp(self, x); |
| 6403 | +} |
| 6404 | + |
| 6405 | +/*[clinic input] |
| 6406 | +_decimal.Context.ln |
| 6407 | +
|
| 6408 | + x: object |
| 6409 | + / |
| 6410 | +
|
| 6411 | +Return the natural (base e) logarithm of x. |
| 6412 | +[clinic start generated code]*/ |
| 6413 | + |
| 6414 | +static PyObject * |
| 6415 | +_decimal_Context_ln(PyObject *self, PyObject *x) |
| 6416 | +/*[clinic end generated code: output=9caae5de322ac831 input=e76c7d7b8912accb]*/ |
| 6417 | +{ |
| 6418 | + return ctx_mpd_qln(self, x); |
| 6419 | +} |
| 6420 | + |
| 6421 | +/*[clinic input] |
| 6422 | +_decimal.Context.log10 |
| 6423 | +
|
| 6424 | + x: object |
| 6425 | + / |
| 6426 | +
|
| 6427 | +Return the base 10 logarithm of x. |
| 6428 | +[clinic start generated code]*/ |
| 6429 | + |
| 6430 | +static PyObject * |
| 6431 | +_decimal_Context_log10(PyObject *self, PyObject *x) |
| 6432 | +/*[clinic end generated code: output=480e54cfd384b3ef input=c0199e3f92fc3075]*/ |
| 6433 | +{ |
| 6434 | + return ctx_mpd_qlog10(self, x); |
| 6435 | +} |
| 6436 | + |
6372 | 6437 | /* Binary arithmetic functions */
|
6373 | 6438 | DecCtx_BinaryFunc(mpd_qadd)
|
6374 | 6439 | DecCtx_BinaryFunc(mpd_qcompare)
|
@@ -6732,10 +6797,10 @@ ctx_mpd_same_quantum(PyObject *context, PyObject *args)
|
6732 | 6797 | static PyMethodDef context_methods [] =
|
6733 | 6798 | {
|
6734 | 6799 | /* Unary arithmetic functions */
|
6735 |
| - { "abs", ctx_mpd_qabs, METH_O, doc_ctx_abs }, |
6736 |
| - { "exp", ctx_mpd_qexp, METH_O, doc_ctx_exp }, |
6737 |
| - { "ln", ctx_mpd_qln, METH_O, doc_ctx_ln }, |
6738 |
| - { "log10", ctx_mpd_qlog10, METH_O, doc_ctx_log10 }, |
| 6800 | + _DECIMAL_CONTEXT_ABS_METHODDEF |
| 6801 | + _DECIMAL_CONTEXT_EXP_METHODDEF |
| 6802 | + _DECIMAL_CONTEXT_LN_METHODDEF |
| 6803 | + _DECIMAL_CONTEXT_LOG10_METHODDEF |
6739 | 6804 | { "minus", ctx_mpd_qminus, METH_O, doc_ctx_minus },
|
6740 | 6805 | { "next_minus", ctx_mpd_qnext_minus, METH_O, doc_ctx_next_minus },
|
6741 | 6806 | { "next_plus", ctx_mpd_qnext_plus, METH_O, doc_ctx_next_plus },
|
|
0 commit comments