Kaydet (Commit) 7ceab654 authored tarafından Jeremy Hylton's avatar Jeremy Hylton

Fix bogus error reporting on strptime: let PyArg_ParseTuple set exception.

Also, wrap long line.
üst d0d366b5
...@@ -373,7 +373,8 @@ time_strftime(self, args) ...@@ -373,7 +373,8 @@ time_strftime(self, args)
memset((ANY *) &buf, '\0', sizeof(buf)); 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; return NULL;
fmtlen = strlen(fmt); fmtlen = strlen(fmt);
...@@ -421,10 +422,8 @@ time_strptime(self, args) ...@@ -421,10 +422,8 @@ time_strptime(self, args)
char *buf; char *buf;
char *s; char *s;
if (!PyArg_ParseTuple(args, "s|s:strptime", &buf, &fmt)) { if (!PyArg_ParseTuple(args, "s|s:strptime", &buf, &fmt))
PyErr_SetString(PyExc_ValueError, "invalid argument"); return NULL;
return NULL;
}
memset((ANY *) &tm, '\0', sizeof(tm)); memset((ANY *) &tm, '\0', sizeof(tm));
s = strptime(buf, fmt, &tm); s = strptime(buf, fmt, &tm);
if (s == NULL) { if (s == NULL) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment