diff options
author | Guido van Rossum <guido@python.org> | 2001-09-15 03:14:32 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2001-09-15 03:14:32 (GMT) |
commit | 7e35d57c0cd94b136d613129cb22a2b4252aa008 (patch) | |
tree | 04cbba26e20c258dff63ab627b21906641d5c58a /Lib | |
parent | 0891ac017dd02f9c592c40940dff6b050523be00 (diff) | |
download | cpython-7e35d57c0cd94b136d613129cb22a2b4252aa008.zip cpython-7e35d57c0cd94b136d613129cb22a2b4252aa008.tar.gz cpython-7e35d57c0cd94b136d613129cb22a2b4252aa008.tar.bz2 |
A fix for SF bug #461546 (bug in long_mul).
Both int and long multiplication are changed to be more careful in
their assumptions about when one of the arguments is a sequence: the
assumption that at least one of the arguments must be an int (or long,
respectively) is still held, but the assumption that these don't smell
like sequences is no longer true: a subtype of int or long may well
have a sequence-repeat thingie!
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_descr.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/Lib/test/test_descr.py b/Lib/test/test_descr.py index 06631dc..3b3a34e 100644 --- a/Lib/test/test_descr.py +++ b/Lib/test/test_descr.py @@ -896,6 +896,19 @@ def dynamics(): d.foo = 1 verify(d.foo == 1) + # Test handling of int*seq and seq*int + class I(int): + __dynamic__ = 1 + verify("a"*I(2) == "aa") + verify(I(2)*"a" == "aa") + + # Test handling of long*seq and seq*long + class L(long): + __dynamic__ = 1 + verify("a"*L(2L) == "aa") + verify(L(2L)*"a" == "aa") + + def errors(): if verbose: print "Testing errors..." |