[Python-checkins] python/dist/src/Objects intobject.c,2.89,2.90

gvanrossum@users.sourceforge.net gvanrossum@users.sourceforge.net
Tue, 13 Aug 2002 03:06:02 -0700


Update of /cvsroot/python/python/dist/src/Objects
In directory usw-pr-cvs1:/tmp/cvs-serv9729

Modified Files:
	intobject.c 
Log Message:
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.


Index: intobject.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Objects/intobject.c,v
retrieving revision 2.89
retrieving revision 2.90
diff -C2 -d -r2.89 -r2.90
*** intobject.c	11 Aug 2002 17:54:42 -0000	2.89
--- intobject.c	13 Aug 2002 10:05:56 -0000	2.90
***************
*** 346,351 ****
  			  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))
  static PyObject *
  int_mul(PyObject *v, PyObject *w)
--- 346,353 ----
  			  o->ob_type->tp_as_sequence && \
  			  o->ob_type->tp_as_sequence->sq_repeat && \
! 			  !(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)