summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2018-10-19 21:46:31 (GMT)
committerVictor Stinner <vstinner@redhat.com>2018-10-19 21:46:31 (GMT)
commitb2e2025941f6a4fdb716bd141d31acf720353d21 (patch)
tree3c372b7dc98aec792be04617f3b7626904190351 /Objects
parentb981fec8d63697e8265d016582ce84944f272d55 (diff)
downloadcpython-b2e2025941f6a4fdb716bd141d31acf720353d21.zip
cpython-b2e2025941f6a4fdb716bd141d31acf720353d21.tar.gz
cpython-b2e2025941f6a4fdb716bd141d31acf720353d21.tar.bz2
bpo-33073: Rework int.as_integer_ratio() implementation (GH-9303)
* Simplify the C code. * Simplify tests and make them more strict and robust. * Add references in the documentation.
Diffstat (limited to 'Objects')
-rw-r--r--Objects/longobject.c7
1 files changed, 1 insertions, 6 deletions
diff --git a/Objects/longobject.c b/Objects/longobject.c
index ae3a98c..6f7fe33 100644
--- a/Objects/longobject.c
+++ b/Objects/longobject.c
@@ -5280,13 +5280,8 @@ static PyObject *
int_as_integer_ratio_impl(PyObject *self)
/*[clinic end generated code: output=e60803ae1cc8621a input=55ce3058e15de393]*/
{
- PyObject *numerator;
PyObject *ratio_tuple;
-
- if (PyLong_CheckExact(self)) {
- return PyTuple_Pack(2, self, _PyLong_One);
- }
- numerator = _PyLong_Copy((PyLongObject *) self);
+ PyObject *numerator = long_long(self);
if (numerator == NULL) {
return NULL;
}