diff options
author | Guido van Rossum <guido@python.org> | 2000-01-12 16:38:20 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2000-01-12 16:38:20 (GMT) |
commit | b2b42ddcb1a09c58fdbd638c6fcdae5af13d7965 (patch) | |
tree | 79e490cf1fc967ea95fe49a24d4198902a1484af /Modules | |
parent | 687ef6e70bf17f33d8fe0635dabb32ccc4cf4133 (diff) | |
download | cpython-b2b42ddcb1a09c58fdbd638c6fcdae5af13d7965.zip cpython-b2b42ddcb1a09c58fdbd638c6fcdae5af13d7965.tar.gz cpython-b2b42ddcb1a09c58fdbd638c6fcdae5af13d7965.tar.bz2 |
The functions asctime() and mktime() are documented to take a 9-tuple
only. Through some mysterious interaction, they would take 9 separate
arguments as well. This misfeature is now disabled (to end a
difference with JPython).
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/timemodule.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/Modules/timemodule.c b/Modules/timemodule.c index 417825d..1d0fc3c 100644 --- a/Modules/timemodule.c +++ b/Modules/timemodule.c @@ -452,9 +452,12 @@ time_asctime(self, args) PyObject *self; PyObject *args; { + PyObject *tup; struct tm buf; char *p; - if (!gettmarg(args, &buf)) + if (!PyArg_ParseTuple(args, "O", &tup)) + return NULL; + if (!gettmarg(tup, &buf)) return NULL; p = asctime(&buf); if (p[24] == '\n') @@ -500,11 +503,14 @@ time_mktime(self, args) PyObject *self; PyObject *args; { + PyObject *tup; struct tm buf; time_t tt; + if (!PyArg_ParseTuple(args, "O", &tup)) + return NULL; tt = time(&tt); buf = *localtime(&tt); - if (!gettmarg(args, &buf)) + if (!gettmarg(tup, &buf)) return NULL; tt = mktime(&buf); if (tt == (time_t)(-1)) { @@ -529,10 +535,10 @@ static PyMethodDef time_methods[] = { {"sleep", time_sleep, 0, sleep_doc}, {"gmtime", time_gmtime, 0, gmtime_doc}, {"localtime", time_localtime, 0, localtime_doc}, - {"asctime", time_asctime, 0, asctime_doc}, + {"asctime", time_asctime, 1, asctime_doc}, {"ctime", time_ctime, 0, ctime_doc}, #ifdef HAVE_MKTIME - {"mktime", time_mktime, 0, mktime_doc}, + {"mktime", time_mktime, 1, mktime_doc}, #endif #ifdef HAVE_STRFTIME {"strftime", time_strftime, 1, strftime_doc}, |