summaryrefslogtreecommitdiffstats
path: root/Modules/datetimemodule.c
diff options
context:
space:
mode:
authorBrett Cannon <bcannon@gmail.com>2004-03-02 04:38:10 (GMT)
committerBrett Cannon <bcannon@gmail.com>2004-03-02 04:38:10 (GMT)
commitd1080a3418b2a162b44d0d5738a6da2276133eb7 (patch)
tree73902ccab6d9c184e726722e1e999fc460b5a90b /Modules/datetimemodule.c
parent0a4977c2f3b8b3cd80f326f44e87076b2578b1b6 (diff)
downloadcpython-d1080a3418b2a162b44d0d5738a6da2276133eb7.zip
cpython-d1080a3418b2a162b44d0d5738a6da2276133eb7.tar.gz
cpython-d1080a3418b2a162b44d0d5738a6da2276133eb7.tar.bz2
Have strftime() check its time tuple argument to make sure the tuple's values
are within proper boundaries as specified in the docs. This can break possible code (datetime module needed changing, for instance) that uses 0 for values that need to be greater 1 or greater (month, day, and day of year). Fixes bug #897625.
Diffstat (limited to 'Modules/datetimemodule.c')
-rw-r--r--Modules/datetimemodule.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/Modules/datetimemodule.c b/Modules/datetimemodule.c
index 3de1c65..c68c368 100644
--- a/Modules/datetimemodule.c
+++ b/Modules/datetimemodule.c
@@ -3189,11 +3189,11 @@ time_strftime(PyDateTime_Time *self, PyObject *args, PyObject *kw)
* 1900 to worm around that.
*/
tuple = Py_BuildValue("iiiiiiiii",
- 1900, 0, 0, /* year, month, day */
+ 1900, 1, 1, /* year, month, day */
TIME_GET_HOUR(self),
TIME_GET_MINUTE(self),
TIME_GET_SECOND(self),
- 0, 0, -1); /* weekday, daynum, dst */
+ 0, 1, -1); /* weekday, daynum, dst */
if (tuple == NULL)
return NULL;
assert(PyTuple_Size(tuple) == 9);