Author vstinner
Recipients Jordon Phillips, belopolsky, dstufft, vstinner
Date 2017-01-03.23:12:41
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1483485161.94.0.763876502127.issue29100@psf.upfronthosting.co.za>
In-reply-to
Content
Oh, datetime.datetime.timestamp() also has a bug for values close to 0001-01-01 (year 1), at least in my timezone (CET).

$ ./python -c 'import datetime; datetime.datetime.min.timestamp()'
python: /home/haypo/prog/python/default/Modules/_datetimemodule.c:251: days_before_year: Assertion `year >= 1' failed.
Aborted (core dumped)

datetime_check_args.patch doesn't fix this issue. A solution is to check that year>=1 in utc_to_seconds():

+    if (year < MINYEAR || year > MAXYEAR) {
+        PyErr_SetString(PyExc_ValueError,
+                        "year is out of range");
+        return -1;
+    }

Maybe it would solve the following local() comment:

   /* XXX: add bounds checking */
History
Date User Action Args
2017-01-03 23:12:41vstinnersetrecipients: + vstinner, belopolsky, dstufft, Jordon Phillips
2017-01-03 23:12:41vstinnersetmessageid: <1483485161.94.0.763876502127.issue29100@psf.upfronthosting.co.za>
2017-01-03 23:12:41vstinnerlinkissue29100 messages
2017-01-03 23:12:41vstinnercreate