diff options
author | Kirill Podoprigora <kirill.bast9@mail.ru> | 2024-06-07 08:03:28 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-07 08:03:28 (GMT) |
commit | 57ad769076201c858a768d81047f6ea44925a33b (patch) | |
tree | f6dc9e6cbdd2732be17f6029bc795396d80c809b /Objects/longobject.c | |
parent | bd826b9c77dbf7c789433cb8061c733c08634c0e (diff) | |
download | cpython-57ad769076201c858a768d81047f6ea44925a33b.zip cpython-57ad769076201c858a768d81047f6ea44925a33b.tar.gz cpython-57ad769076201c858a768d81047f6ea44925a33b.tar.bz2 |
gh-120080: Accept ``None`` as a valid argument for direct call of the ``int.__round__`` (#120088)
Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
Diffstat (limited to 'Objects/longobject.c')
-rw-r--r-- | Objects/longobject.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Objects/longobject.c b/Objects/longobject.c index ee0b2a0..a3a59a2 100644 --- a/Objects/longobject.c +++ b/Objects/longobject.c @@ -6045,7 +6045,7 @@ _PyLong_DivmodNear(PyObject *a, PyObject *b) /*[clinic input] int.__round__ - ndigits as o_ndigits: object = NULL + ndigits as o_ndigits: object = None / Rounding an Integral returns itself. @@ -6055,7 +6055,7 @@ Rounding with an ndigits argument also returns an integer. static PyObject * int___round___impl(PyObject *self, PyObject *o_ndigits) -/*[clinic end generated code: output=954fda6b18875998 input=1614cf23ec9e18c3]*/ +/*[clinic end generated code: output=954fda6b18875998 input=30c2aec788263144]*/ { PyObject *temp, *result, *ndigits; @@ -6073,7 +6073,7 @@ int___round___impl(PyObject *self, PyObject *o_ndigits) * * m - divmod_near(m, 10**n)[1]. */ - if (o_ndigits == NULL) + if (o_ndigits == Py_None) return long_long(self); ndigits = _PyNumber_Index(o_ndigits); |