Skip to content

Commit 3584f8a

Browse files
committed
address review: redo macro
1 parent f00faec commit 3584f8a

File tree

1 file changed

+10
-44
lines changed

1 file changed

+10
-44
lines changed

Modules/_decimal/_decimal.c

Lines changed: 10 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -4358,8 +4358,6 @@ dec_##MPDFUNC(PyObject *self, PyObject *args, PyObject *kwds) \
43584358

43594359
/* Unary function with an optional context arg. */
43604360
#define Dec_UnaryFuncVA(MPDFUNC) \
4361-
static PyObject * \
4362-
dec_##MPDFUNC(PyObject *self, PyObject *context) \
43634361
{ \
43644362
PyObject *result; \
43654363
uint32_t status = 0; \
@@ -4455,8 +4453,6 @@ dec_##MPDFUNC(PyObject *self, PyObject *args, PyObject *kwds) \
44554453

44564454
/* Ternary function with an optional context arg. */
44574455
#define Dec_TernaryFuncVA(MPDFUNC) \
4458-
static PyObject * \
4459-
dec_##MPDFUNC(PyObject *self, PyObject *other, PyObject *third, PyObject *context) \
44604456
{ \
44614457
PyObject *a, *b, *c; \
44624458
PyObject *result; \
@@ -4610,13 +4606,6 @@ nm_mpd_qpow(PyObject *base, PyObject *exp, PyObject *mod)
46104606
/******************************************************************************/
46114607

46124608
/* Unary arithmetic functions, optional context arg */
4613-
Dec_UnaryFuncVA(mpd_qexp)
4614-
Dec_UnaryFuncVA(mpd_qln)
4615-
Dec_UnaryFuncVA(mpd_qlog10)
4616-
Dec_UnaryFuncVA(mpd_qnext_minus)
4617-
Dec_UnaryFuncVA(mpd_qnext_plus)
4618-
Dec_UnaryFuncVA(mpd_qreduce)
4619-
Dec_UnaryFuncVA(mpd_qsqrt)
46204609

46214610
/*[clinic input]
46224611
_decimal.Decimal.exp
@@ -4632,9 +4621,7 @@ correctly rounded.
46324621
static PyObject *
46334622
_decimal_Decimal_exp_impl(PyObject *self, PyObject *context)
46344623
/*[clinic end generated code: output=c0833b6e9b8c836f input=274784af925e60c9]*/
4635-
{
4636-
return dec_mpd_qexp(self, context);
4637-
}
4624+
Dec_UnaryFuncVA(mpd_qexp)
46384625

46394626
/*[clinic input]
46404627
_decimal.Decimal.ln
@@ -4650,9 +4637,7 @@ correctly rounded.
46504637
static PyObject *
46514638
_decimal_Decimal_ln_impl(PyObject *self, PyObject *context)
46524639
/*[clinic end generated code: output=5191f4ef739b04b0 input=f267b224238c56e2]*/
4653-
{
4654-
return dec_mpd_qln(self, context);
4655-
}
4640+
Dec_UnaryFuncVA(mpd_qln)
46564641

46574642
/*[clinic input]
46584643
_decimal.Decimal.log10
@@ -4668,9 +4653,7 @@ correctly rounded.
46684653
static PyObject *
46694654
_decimal_Decimal_log10_impl(PyObject *self, PyObject *context)
46704655
/*[clinic end generated code: output=d5da63df75900275 input=d941f9335dc693cb]*/
4671-
{
4672-
return dec_mpd_qlog10(self, context);
4673-
}
4656+
Dec_UnaryFuncVA(mpd_qlog10)
46744657

46754658
/*[clinic input]
46764659
_decimal.Decimal.next_minus
@@ -4683,9 +4666,7 @@ Returns the largest representable number smaller than itself.
46834666
static PyObject *
46844667
_decimal_Decimal_next_minus_impl(PyObject *self, PyObject *context)
46854668
/*[clinic end generated code: output=aacbd758399f883f input=75666c6dc3cc8da9]*/
4686-
{
4687-
return dec_mpd_qnext_minus(self, context);
4688-
}
4669+
Dec_UnaryFuncVA(mpd_qnext_minus)
46894670

46904671
/*[clinic input]
46914672
_decimal.Decimal.next_plus
@@ -4698,9 +4679,7 @@ Returns the smallest representable number larger than itself.
46984679
static PyObject *
46994680
_decimal_Decimal_next_plus_impl(PyObject *self, PyObject *context)
47004681
/*[clinic end generated code: output=f3a7029a213c553c input=adcccf3f94e8da3f]*/
4701-
{
4702-
return dec_mpd_qnext_plus(self, context);
4703-
}
4682+
Dec_UnaryFuncVA(mpd_qnext_plus)
47044683

47054684
/*[clinic input]
47064685
_decimal.Decimal.normalize
@@ -4718,9 +4697,7 @@ the equivalent value Decimal('32.1').
47184697
static PyObject *
47194698
_decimal_Decimal_normalize_impl(PyObject *self, PyObject *context)
47204699
/*[clinic end generated code: output=db2c8b3c8eccff36 input=8f0504baa4e8c7de]*/
4721-
{
4722-
return dec_mpd_qreduce(self, context);
4723-
}
4700+
Dec_UnaryFuncVA(mpd_qreduce)
47244701

47254702
/*[clinic input]
47264703
_decimal.Decimal.sqrt
@@ -4735,9 +4712,7 @@ The result is correctly rounded using the ROUND_HALF_EVEN rounding mode.
47354712
static PyObject *
47364713
_decimal_Decimal_sqrt_impl(PyObject *self, PyObject *context)
47374714
/*[clinic end generated code: output=420722a199dd9c2b input=16df570867daf0d6]*/
4738-
{
4739-
return dec_mpd_qsqrt(self, context);
4740-
}
4715+
Dec_UnaryFuncVA(mpd_qsqrt)
47414716

47424717
/* Binary arithmetic functions, optional context arg */
47434718
Dec_BinaryFuncVA(mpd_qcompare)
@@ -4750,7 +4725,6 @@ Dec_BinaryFuncVA(mpd_qnext_toward)
47504725
Dec_BinaryFuncVA(mpd_qrem_near)
47514726

47524727
/* Ternary arithmetic functions, optional context arg */
4753-
Dec_TernaryFuncVA(mpd_qfma)
47544728

47554729
/*[clinic input]
47564730
_decimal.Decimal.fma
@@ -4772,9 +4746,7 @@ static PyObject *
47724746
_decimal_Decimal_fma_impl(PyObject *self, PyObject *other, PyObject *third,
47734747
PyObject *context)
47744748
/*[clinic end generated code: output=74a82b984e227b69 input=48f9aec6f389227a]*/
4775-
{
4776-
return dec_mpd_qfma(self, other, third, context);
4777-
}
4749+
Dec_TernaryFuncVA(mpd_qfma)
47784750

47794751
/* Boolean functions, no context arg */
47804752
Dec_BoolFunc(mpd_iscanonical)
@@ -4937,8 +4909,6 @@ _decimal_Decimal_copy_negate_impl(PyObject *self)
49374909
}
49384910

49394911
/* Unary functions, optional context arg */
4940-
Dec_UnaryFuncVA(mpd_qinvert)
4941-
Dec_UnaryFuncVA(mpd_qlogb)
49424912

49434913
/*[clinic input]
49444914
_decimal.Decimal.logical_invert
@@ -4951,9 +4921,7 @@ Return the digit-wise inversion of the (logical) operand.
49514921
static PyObject *
49524922
_decimal_Decimal_logical_invert_impl(PyObject *self, PyObject *context)
49534923
/*[clinic end generated code: output=59beb9b1b51b9f34 input=063cc759635d249b]*/
4954-
{
4955-
return dec_mpd_qinvert(self, context);
4956-
}
4924+
Dec_UnaryFuncVA(mpd_qinvert)
49574925

49584926
/*[clinic input]
49594927
_decimal.Decimal.logb
@@ -4970,9 +4938,7 @@ Decimal('Infinity') is returned.
49704938
static PyObject *
49714939
_decimal_Decimal_logb_impl(PyObject *self, PyObject *context)
49724940
/*[clinic end generated code: output=f278db20b47f301c input=1a0de8e49b101734]*/
4973-
{
4974-
return dec_mpd_qlogb(self, context);
4975-
}
4941+
Dec_UnaryFuncVA(mpd_qlogb)
49764942

49774943
/*[clinic input]
49784944
_decimal.Decimal.number_class

0 commit comments

Comments
 (0)