Martin Panter added the comment:

The C "_datetime" implementation seems to handle this as documented. But either 
way, the "timedelta" range is greater than the "datetime" range, so it seems to 
be just a difference in OverflowError messages, not a big practical problem:

Python "datetime" implementation:
>>> import sys
>>> sys.modules["_datetime"] = None
>>> from datetime import *
>>> datetime.max - timedelta.max
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File 
"C:\Users\Martin\AppData\Local\Programs\Python\Python35-32\lib\datetime.py", 
line 1741, in __sub__
    return self + -other
  File 
"C:\Users\Martin\AppData\Local\Programs\Python\Python35-32\lib\datetime.py", 
line 518, in __neg__
    -self._microseconds)
  File 
"C:\Users\Martin\AppData\Local\Programs\Python\Python35-32\lib\datetime.py", 
line 430, in __new__
    raise OverflowError("timedelta # of days is too large: %d" % d)
OverflowError: timedelta # of days is too large: -1000000000

C "_datetime" implementation:
>>> from datetime import *
>>> datetime.max - timedelta.max
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
OverflowError: date value out of range

----------
nosy: +martin.panter

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue30516>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to