Nick Coghlan <[email protected]> added the comment:
The precedence problems described in #11477 shouldn't factor into this case -
that issue is specific to C level types that implement + and * via
tp_as_sequence *without* implementing the corresponding slots in tp_as_number.
That's not the case here, since datetime types *only* implement the slots via
tp_as_number.
I can't reproduce the failure at all, so here's a couple of tricks for Windows
users trying to reproduce or investigate the problem:
# Getting the C version of datetime:
import _datetime as cdt
# Getting the pure Python version of datetime:
from test.support import import_fresh_module
pydt = import_fresh_module("datetime", blocked=["_datetime"])
# Test the results of all the following operations
d+1
1+d
d.__add__(1)
d.__radd__(1)
1 .__add__(d)
1 .__radd__(d)
# For the following kinds of "d"
d = cdt.datetime(1, 2, 3)
d = pydt.datetime(1, 2, 3)
class SubC(cdt.datetime): pass
d = SubC(1, 2, 3)
class SubPy(cdt.datetime): pass
d = SubPy(1, 2, 3)
----------
components: +Interpreter Core -Library (Lib)
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue10654>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com