Commit 4571e9d4 authored by Guido van Rossum's avatar Guido van Rossum

Add an improvement wrinkle to Neil Schemenauer's change to int_mul

(rev. 2.86).  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.
parent d0876b85
...@@ -345,8 +345,10 @@ product that must have overflowed. ...@@ -345,8 +345,10 @@ product that must have overflowed.
#define USE_SQ_REPEAT(o) (!PyInt_Check(o) && \ #define USE_SQ_REPEAT(o) (!PyInt_Check(o) && \
o->ob_type->tp_as_sequence && \ o->ob_type->tp_as_sequence && \
o->ob_type->tp_as_sequence->sq_repeat && \ o->ob_type->tp_as_sequence->sq_repeat && \
(!o->ob_type->tp_as_number || \ !(o->ob_type->tp_as_number && \
!o->ob_type->tp_as_number->nb_multiply)) o->ob_type->tp_flags & Py_TPFLAGS_CHECKTYPES && \
o->ob_type->tp_as_number->nb_multiply))
static PyObject * static PyObject *
int_mul(PyObject *v, PyObject *w) int_mul(PyObject *v, PyObject *w)
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment