[Python-checkins] python/dist/src/Lib/test test_descr.py,1.113.4.11,1.113.4.12

anthonybaxter@sourceforge.net anthonybaxter@sourceforge.net
Wed, 17 Apr 2002 21:46:51 -0700


Update of /cvsroot/python/python/dist/src/Lib/test
In directory usw-pr-cvs1:/tmp/cvs-serv6820/Lib/test

Modified Files:
      Tag: release22-maint
	test_descr.py 
Log Message:
backport gvanrossum's patch:

SF bug 544647.

PyNumber_InPlaceMultiply insisted on calling sq_inplace_repeat if it
existed, even if nb_inplace_multiply also existed and the arguments
weren't right for sq_inplace_repeat.  Change this to only use
sq_inplace_repeat if nb_inplace_multiply isn't defined.

Bugfix candidate.


Index: test_descr.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_descr.py,v
retrieving revision 1.113.4.11
retrieving revision 1.113.4.12
diff -C2 -d -r1.113.4.11 -r1.113.4.12
*** test_descr.py	18 Apr 2002 00:37:10 -0000	1.113.4.11
--- test_descr.py	18 Apr 2002 04:46:49 -0000	1.113.4.12
***************
*** 2863,2866 ****
--- 2863,2892 ----
      vereq(NewClass().__doc__, 'object=NewClass instance; type=NewClass')
  
+ def imulbug():
+     # SF bug 544647
+     if verbose: print "Testing for __imul__ problems..."
+     class C(object):
+         def __imul__(self, other):
+             return (self, other)
+     x = C()
+     y = x
+     y *= 1.0
+     vereq(y, (x, 1.0))
+     y = x
+     y *= 2
+     vereq(y, (x, 2))
+     y = x
+     y *= 3L
+     vereq(y, (x, 3L))
+     y = x
+     y *= 1L<<100
+     vereq(y, (x, 1L<<100))
+     y = x
+     y *= None
+     vereq(y, (x, None))
+     y = x
+     y *= "foo"
+     vereq(y, (x, "foo"))
+ 
  def test_main():
      class_docstrings()
***************
*** 2921,2924 ****
--- 2947,2951 ----
      pickleslots()
      docdescriptor()
+     imulbug()
      if verbose: print "All OK"