diff options
author | Jeremy Hylton <jeremy@alum.mit.edu> | 2000-03-14 21:17:16 (GMT) |
---|---|---|
committer | Jeremy Hylton <jeremy@alum.mit.edu> | 2000-03-14 21:17:16 (GMT) |
commit | 7ceab654684eb3041c3d1e25ea860b7bd76daa2f (patch) | |
tree | fadf3c0ee29ecf5f04475c81df6865241dd707b7 | |
parent | d0d366b5e6505b485ea3a56ddac55be72aa9af14 (diff) | |
download | cpython-7ceab654684eb3041c3d1e25ea860b7bd76daa2f.zip cpython-7ceab654684eb3041c3d1e25ea860b7bd76daa2f.tar.gz cpython-7ceab654684eb3041c3d1e25ea860b7bd76daa2f.tar.bz2 |
Fix bogus error reporting on strptime: let PyArg_ParseTuple set exception.
Also, wrap long line.
-rw-r--r-- | Modules/timemodule.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/Modules/timemodule.c b/Modules/timemodule.c index 392f2b9..d5a598b 100644 --- a/Modules/timemodule.c +++ b/Modules/timemodule.c @@ -373,7 +373,8 @@ time_strftime(self, args) memset((ANY *) &buf, '\0', sizeof(buf)); - if (!PyArg_ParseTuple(args, "sO:strftime", &fmt, &tup) || !gettmarg(tup, &buf)) + if (!PyArg_ParseTuple(args, "sO:strftime", &fmt, &tup) + || !gettmarg(tup, &buf)) return NULL; fmtlen = strlen(fmt); @@ -421,10 +422,8 @@ time_strptime(self, args) char *buf; char *s; - if (!PyArg_ParseTuple(args, "s|s:strptime", &buf, &fmt)) { - PyErr_SetString(PyExc_ValueError, "invalid argument"); - return NULL; - } + if (!PyArg_ParseTuple(args, "s|s:strptime", &buf, &fmt)) + return NULL; memset((ANY *) &tm, '\0', sizeof(tm)); s = strptime(buf, fmt, &tm); if (s == NULL) { |