Terry J. Reedy <tjre...@udel.edu> added the comment: I do not see the error with installed 3.2.3. I **DO** see it consistently, when running the test with installed 3.3.0b1 on 64 bit Win 7. The only failure is ====================================================================== FAIL: test_computations (test.datetimetester.TestSubclassDateTime_Fast) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\Programs\Python33\lib\test\datetimetester.py", line 1640, in test_computations self.assertRaises(TypeError, lambda: a+i) AssertionError: TypeError not raised by <lambda> ionError: TypeError not raised by <lambda>
The other 9 runs of test_computations pass. test_computations (test.datetimetester.TestDate_Pure) ... ok test_computations (test.datetimetester.TestDateTimeTZ_Pure) ... ok test_computations (test.datetimetester.TestTimeDelta_Pure) ... ok test_computations (test.datetimetester.TestSubclassDateTime_Pure) ... ok test_computations (test.datetimetester.TestDateTime_Pure) ... ok test_computations (test.datetimetester.TestDate_Fast) ... ok test_computations (test.datetimetester.TestDateTimeTZ_Fast) ... ok test_computations (test.datetimetester.TestTimeDelta_Fast) ... ok test_computations (test.datetimetester.TestDateTime_Fast) ... ok I reproduce in same way Hirokazo does. >>> class Sub(datetime): pass >>> dsub = Sub(2002, 1, 31) >>> dsub+1 NotImplemented >>> d = datetime(2000,1,1) >>> d+1 Traceback (most recent call last): File "<pyshell#28>", line 1, in <module> b+1 TypeError: unsupported operand type(s) for +: 'datetime.datetime' and 'int' My understanding of a+b is that a.__add__(b) is tried and if it NotImplemented, which d and dsub.__add__(1) do, b.__radd__(a) is tried. If that does the same, TypeError is raised. 1 .__radd__(x) returns NotImplemented for both d and dsub, but TypeError is raised only for d, not dsub. Alexander, there are known problems with abstract.c #11477 Nick, I nosied you because you have worked on the binary op dance. Are there special problems for Python subclasses of builtins? Is this problem the same or related to the one in #11477? ---------- nosy: +ncoghlan, terry.reedy stage: -> needs patch title: test_datetime fails on Python3.2 windows binary -> test_datetime sometimes fails on Python3.x windows binary versions: +Python 3.3 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue10654> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com