Skip to content

Commit 8b757da

Browse files
committed
address review: rename some self
1 parent 81cba59 commit 8b757da

File tree

2 files changed

+38
-33
lines changed

2 files changed

+38
-33
lines changed

Modules/_decimal/_decimal.c

Lines changed: 24 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3921,6 +3921,7 @@ _decimal_Decimal_as_integer_ratio_impl(PyObject *self)
39213921
/*[clinic input]
39223922
_decimal.Decimal.to_integral_value
39233923
3924+
self as dec: self
39243925
rounding: object = None
39253926
context: object = None
39263927
@@ -3932,15 +3933,15 @@ the current default context is used.
39323933
[clinic start generated code]*/
39333934

39343935
static PyObject *
3935-
_decimal_Decimal_to_integral_value_impl(PyObject *self, PyObject *rounding,
3936+
_decimal_Decimal_to_integral_value_impl(PyObject *dec, PyObject *rounding,
39363937
PyObject *context)
3937-
/*[clinic end generated code: output=7301465765f48b6b input=5778168222cadf71]*/
3938+
/*[clinic end generated code: output=1517d948029dbecc input=0fd8dd3bc5248b21]*/
39383939
{
39393940
PyObject *result;
39403941
uint32_t status = 0;
39413942
mpd_context_t workctx;
39423943

3943-
decimal_state *state = get_module_state_by_def(Py_TYPE(self));
3944+
decimal_state *state = get_module_state_by_def(Py_TYPE(dec));
39443945
CONTEXT_CHECK_VA(state, context);
39453946

39463947
workctx = *CTX(context);
@@ -3959,7 +3960,7 @@ _decimal_Decimal_to_integral_value_impl(PyObject *self, PyObject *rounding,
39593960
return NULL;
39603961
}
39613962

3962-
mpd_qround_to_int(MPD(result), MPD(self), &workctx, &status);
3963+
mpd_qround_to_int(MPD(result), MPD(dec), &workctx, &status);
39633964
if (dec_addstatus(context, status)) {
39643965
Py_DECREF(result);
39653966
return NULL;
@@ -3990,6 +3991,7 @@ _decimal_Decimal_to_integral_impl(PyObject *self, PyObject *rounding,
39903991
/*[clinic input]
39913992
_decimal.Decimal.to_integral_exact
39923993
3994+
self as dec: self
39933995
rounding: object = None
39943996
context: object = None
39953997
@@ -4002,15 +4004,15 @@ rounding mode of the current default context is used.
40024004
[clinic start generated code]*/
40034005

40044006
static PyObject *
4005-
_decimal_Decimal_to_integral_exact_impl(PyObject *self, PyObject *rounding,
4007+
_decimal_Decimal_to_integral_exact_impl(PyObject *dec, PyObject *rounding,
40064008
PyObject *context)
4007-
/*[clinic end generated code: output=8b004f9b45ac7746 input=edd30a9f06aed70b]*/
4009+
/*[clinic end generated code: output=bfcd6d3ac47460d7 input=095a7cc7368dcfbb]*/
40084010
{
40094011
PyObject *result;
40104012
uint32_t status = 0;
40114013
mpd_context_t workctx;
40124014

4013-
decimal_state *state = get_module_state_by_def(Py_TYPE(self));
4015+
decimal_state *state = get_module_state_by_def(Py_TYPE(dec));
40144016
CONTEXT_CHECK_VA(state, context);
40154017

40164018
workctx = *CTX(context);
@@ -4029,7 +4031,7 @@ _decimal_Decimal_to_integral_exact_impl(PyObject *self, PyObject *rounding,
40294031
return NULL;
40304032
}
40314033

4032-
mpd_qround_to_intx(MPD(result), MPD(self), &workctx, &status);
4034+
mpd_qround_to_intx(MPD(result), MPD(dec), &workctx, &status);
40334035
if (dec_addstatus(context, status)) {
40344036
Py_DECREF(result);
40354037
return NULL;
@@ -4123,12 +4125,14 @@ PyDec_Round(PyObject *dec, PyObject *args)
41234125
/*[clinic input]
41244126
_decimal.Decimal.as_tuple
41254127
4128+
self as dec: self
4129+
41264130
Return a tuple representation of the number.
41274131
[clinic start generated code]*/
41284132

41294133
static PyObject *
4130-
_decimal_Decimal_as_tuple_impl(PyObject *self)
4131-
/*[clinic end generated code: output=c6e8e2420c515eca input=e26f2151d78ff59d]*/
4134+
_decimal_Decimal_as_tuple_impl(PyObject *dec)
4135+
/*[clinic end generated code: output=b1a619dfdbf89220 input=e334c01206f0e62e]*/
41324136
{
41334137
PyObject *result = NULL;
41344138
PyObject *sign = NULL;
@@ -4140,13 +4144,13 @@ _decimal_Decimal_as_tuple_impl(PyObject *self)
41404144
Py_ssize_t intlen, i;
41414145

41424146

4143-
x = mpd_qncopy(MPD(self));
4147+
x = mpd_qncopy(MPD(dec));
41444148
if (x == NULL) {
41454149
PyErr_NoMemory();
41464150
goto out;
41474151
}
41484152

4149-
sign = PyLong_FromUnsignedLong(mpd_sign(MPD(self)));
4153+
sign = PyLong_FromUnsignedLong(mpd_sign(MPD(dec)));
41504154
if (sign == NULL) {
41514155
goto out;
41524156
}
@@ -4167,7 +4171,7 @@ _decimal_Decimal_as_tuple_impl(PyObject *self)
41674171
expt = PyUnicode_FromString(mpd_isqnan(x)?"n":"N");
41684172
}
41694173
else {
4170-
expt = PyLong_FromSsize_t(MPD(self)->exp);
4174+
expt = PyLong_FromSsize_t(MPD(dec)->exp);
41714175
}
41724176
if (expt == NULL) {
41734177
goto out;
@@ -4208,7 +4212,7 @@ _decimal_Decimal_as_tuple_impl(PyObject *self)
42084212
}
42094213
}
42104214

4211-
decimal_state *state = get_module_state_by_def(Py_TYPE(self));
4215+
decimal_state *state = get_module_state_by_def(Py_TYPE(dec));
42124216
result = PyObject_CallFunctionObjArgs((PyObject *)state->DecimalTuple,
42134217
sign, coeff, expt, NULL);
42144218

@@ -4930,6 +4934,7 @@ Dec_BinaryFuncVA(mpd_qshift)
49304934
/*[clinic input]
49314935
_decimal.Decimal.quantize
49324936
4937+
self as v: self
49334938
exp as w: object
49344939
rounding: object = None
49354940
context: object = None
@@ -4954,16 +4959,16 @@ argument is given, the rounding mode of the current thread's context is used.
49544959
[clinic start generated code]*/
49554960

49564961
static PyObject *
4957-
_decimal_Decimal_quantize_impl(PyObject *self, PyObject *w,
4958-
PyObject *rounding, PyObject *context)
4959-
/*[clinic end generated code: output=5e84581f96dc685c input=2053ebf488a665dc]*/
4962+
_decimal_Decimal_quantize_impl(PyObject *v, PyObject *w, PyObject *rounding,
4963+
PyObject *context)
4964+
/*[clinic end generated code: output=6ebc907ee3000c1f input=223b9dd92655b4bd]*/
49604965
{
49614966
PyObject *a, *b;
49624967
PyObject *result;
49634968
uint32_t status = 0;
49644969
mpd_context_t workctx;
49654970

4966-
decimal_state *state = get_module_state_by_def(Py_TYPE(self));
4971+
decimal_state *state = get_module_state_by_def(Py_TYPE(v));
49674972
CONTEXT_CHECK_VA(state, context);
49684973

49694974
workctx = *CTX(context);
@@ -4977,7 +4982,7 @@ _decimal_Decimal_quantize_impl(PyObject *self, PyObject *w,
49774982
}
49784983
}
49794984

4980-
CONVERT_BINOP_RAISE(&a, &b, self, w, context);
4985+
CONVERT_BINOP_RAISE(&a, &b, v, w, context);
49814986

49824987
result = dec_alloc(state);
49834988
if (result == NULL) {

Modules/_decimal/clinic/_decimal.c.h

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

0 commit comments

Comments
 (0)