This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients belopolsky, m-parry, vstinner
Date 2017-03-28.13:09:58
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1490706598.64.0.0603234159366.issue29921@psf.upfronthosting.co.za>
In-reply-to
Content
> 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.
History
Date User Action Args
2017-03-28 13:09:58vstinnersetrecipients: + vstinner, belopolsky, m-parry
2017-03-28 13:09:58vstinnersetmessageid: <1490706598.64.0.0603234159366.issue29921@psf.upfronthosting.co.za>
2017-03-28 13:09:58vstinnerlinkissue29921 messages
2017-03-28 13:09:58vstinnercreate