From: Guido van Rossum Date: Tue, 13 Aug 2002 10:07:17 +0000 (+0000) Subject: Backport: X-Git-Tag: v2.2.2b1~222 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e5c877f06edbfa24cbbab9c9c83d71e7bbab117b;p=thirdparty%2FPython%2Fcpython.git Backport: Add an improvement wrinkle to Neil Schemenauer's change to int_mul (rev. 2.79.6.3). The other type is only disqualified from sq_repeat when it has the CHECKTYPES flag. This means that for extension types that only support "old-style" numeric ops, such as Zope 2's ExtensionClass, sq_repeat still trumps nb_multiply. --- diff --git a/Objects/intobject.c b/Objects/intobject.c index 2be563180fd6..5daf699ec88d 100644 --- a/Objects/intobject.c +++ b/Objects/intobject.c @@ -348,8 +348,10 @@ product that must have overflowed. #define USE_SQ_REPEAT(o) (!PyInt_Check(o) && \ o->ob_type->tp_as_sequence && \ o->ob_type->tp_as_sequence->sq_repeat && \ - (!o->ob_type->tp_as_number || \ - !o->ob_type->tp_as_number->nb_multiply)) + !(o->ob_type->tp_as_number && \ + o->ob_type->tp_flags & Py_TPFLAGS_CHECKTYPES && \ + o->ob_type->tp_as_number->nb_multiply)) + static PyObject * int_mul(PyObject *v, PyObject *w) {