diff options
author | Guido van Rossum <guido@python.org> | 2002-04-16 16:44:51 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2002-04-16 16:44:51 (GMT) |
commit | e8fc640349dee549e4804df643cf6653a954e125 (patch) | |
tree | 3a03234b84fbca445f0c9241b2c9d2cdd8a90619 /Lib | |
parent | 7766091e0447d6eb641526c8e70b13ab62f7b561 (diff) | |
download | cpython-e8fc640349dee549e4804df643cf6653a954e125.zip cpython-e8fc640349dee549e4804df643cf6653a954e125.tar.gz cpython-e8fc640349dee549e4804df643cf6653a954e125.tar.bz2 |
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.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_descr.py | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/Lib/test/test_descr.py b/Lib/test/test_descr.py index 3e3424a..fc5f2ea 100644 --- a/Lib/test/test_descr.py +++ b/Lib/test/test_descr.py @@ -2929,6 +2929,32 @@ def funnynew(): vereq(isinstance(d, D), True) vereq(d.foo, 1) +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() lists() @@ -2992,6 +3018,7 @@ def test_main(): dictproxyiteritems() pickleslots() funnynew() + imulbug() if verbose: print "All OK" if __name__ == "__main__": |