summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_descr.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2002-10-15 01:01:53 (GMT)
committerGuido van Rossum <guido@python.org>2002-10-15 01:01:53 (GMT)
commit6e5680fc83f3cb66af9c0f3b29ac84d2765293e1 (patch)
treed17f9319f9e7fb479dfd3f5ac91350f79b22f5e5 /Lib/test/test_descr.py
parent13b1a5cc990e4bbffa47d58a6769b5940da7548e (diff)
downloadcpython-6e5680fc83f3cb66af9c0f3b29ac84d2765293e1.zip
cpython-6e5680fc83f3cb66af9c0f3b29ac84d2765293e1.tar.gz
cpython-6e5680fc83f3cb66af9c0f3b29ac84d2765293e1.tar.bz2
For some reason (probably cut and paste), __ipow__ for new-style
classes was called with three arguments. This makes no sense, there's no way to pass in the "modulo" 3rd argument as for __pow__, and classic classes don't do this. [SF bug 620179] I don't want to backport this to 2.2.2, because it could break existing code that has developed a work-around. Code in 2.2.2 that wants to use __ipow__ and wants to be forward compatible with 2.3 should be written like this: def __ipow__(self, exponent, modulo=None): ...
Diffstat (limited to 'Lib/test/test_descr.py')
-rw-r--r--Lib/test/test_descr.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/Lib/test/test_descr.py b/Lib/test/test_descr.py
index 0c7def1..c9bd1cd 100644
--- a/Lib/test/test_descr.py
+++ b/Lib/test/test_descr.py
@@ -3306,6 +3306,16 @@ def testrmul():
vereq(2*a, "rmul")
vereq(2.2*a, "rmul")
+def testipow():
+ # [SF bug 620179]
+ if verbose:
+ print "Testing correct invocation of __ipow__..."
+ class C(object):
+ def __ipow__(self, other):
+ pass
+ a = C()
+ a **= 2
+
def do_this_first():
if verbose:
print "Testing SF bug 551412 ..."
@@ -3401,6 +3411,7 @@ def test_main():
slottrash()
slotmultipleinheritance()
testrmul()
+ testipow()
if verbose: print "All OK"
if __name__ == "__main__":