STINNER Victor added the comment:

> Again, under <3.6.1, that was accepted. (And again, I am making no argument 
> about the validity of this code, just with regards to backwards 
> compatibility.)

You are right that I modified the C API of datetime in Python 3.6.1 to make it 
stricter and reject invalid dates.

I disagree that the "backward incompatibility" part: I consider that it's a 
bugfix, and not a behaviour change.

The datetime module was enhanced in Python 3.6 with the PEP 495 to handle 
better DST changes: a new "fold" attribute was added. Computing this attribute 
requires to handle valid dates in the [datetime.datetime.min; 
datetime.datetime.max] range. Otherwise, you get strange errors like 
OverflowError: see issue #29100.

If Python older than 3.6.1 allowed creating invalid dates, it was a bug, and 
now this bug can lead to new bugs because of the implementation of the PEP 495.

Please fix you code. I now close this issue as NOTABUG. Stricter input 
validation was a deliberate choice.

----------
nosy: +belopolsky
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

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

Reply via email to