diff options
author | Neil Schemenauer <nascheme@enme.ucalgary.ca> | 2002-12-30 20:19:02 (GMT) |
---|---|---|
committer | Neil Schemenauer <nascheme@enme.ucalgary.ca> | 2002-12-30 20:19:02 (GMT) |
commit | 0df295889c79ab93743a502d36402a549559c1f1 (patch) | |
tree | 42f6db5ae9e307267e0f2797ed8c2ae7be283ffb /Objects/longobject.c | |
parent | 9911fc4a418e5a5fa2d5c6028c09cae23ea7dc0c (diff) | |
download | cpython-0df295889c79ab93743a502d36402a549559c1f1.zip cpython-0df295889c79ab93743a502d36402a549559c1f1.tar.gz cpython-0df295889c79ab93743a502d36402a549559c1f1.tar.bz2 |
Consolidate the int and long sequence repeat code. Before the change,
integers checked for integer overflow but longs did not.
Diffstat (limited to 'Objects/longobject.c')
-rw-r--r-- | Objects/longobject.c | 19 |
1 files changed, 0 insertions, 19 deletions
diff --git a/Objects/longobject.c b/Objects/longobject.c index 5038823..cb27e79 100644 --- a/Objects/longobject.c +++ b/Objects/longobject.c @@ -1508,17 +1508,6 @@ long_sub(PyLongObject *v, PyLongObject *w) return (PyObject *)z; } -static PyObject * -long_repeat(PyObject *v, PyLongObject *w) -{ - /* sequence * long */ - long n = PyLong_AsLong((PyObject *) w); - if (n == -1 && PyErr_Occurred()) - return NULL; - else - return (*v->ob_type->tp_as_sequence->sq_repeat)(v, n); -} - /* Grade school multiplication, ignoring the signs. * Returns the absolute value of the product, or NULL if error. */ @@ -1868,14 +1857,6 @@ long_mul(PyLongObject *v, PyLongObject *w) PyLongObject *a, *b, *z; if (!convert_binop((PyObject *)v, (PyObject *)w, &a, &b)) { - if (!PyLong_Check(v) && - v->ob_type->tp_as_sequence && - v->ob_type->tp_as_sequence->sq_repeat) - return long_repeat((PyObject *)v, w); - if (!PyLong_Check(w) && - w->ob_type->tp_as_sequence && - w->ob_type->tp_as_sequence->sq_repeat) - return long_repeat((PyObject *)w, v); Py_INCREF(Py_NotImplemented); return Py_NotImplemented; } |