summaryrefslogtreecommitdiffstats
path: root/Modules/timemodule.c
diff options
context:
space:
mode:
authorAlexander Belopolsky <alexander.belopolsky@gmail.com>2011-01-06 21:57:06 (GMT)
committerAlexander Belopolsky <alexander.belopolsky@gmail.com>2011-01-06 21:57:06 (GMT)
commit610e544bf72c9e29f216af8ab23544ee6ae45b39 (patch)
tree8775a08fbfbc162d95be99dfa2a9e7a24c070d8f /Modules/timemodule.c
parent388af4bb35a9d5cc379c5f30f72349611c4f28b2 (diff)
downloadcpython-610e544bf72c9e29f216af8ab23544ee6ae45b39.zip
cpython-610e544bf72c9e29f216af8ab23544ee6ae45b39.tar.gz
cpython-610e544bf72c9e29f216af8ab23544ee6ae45b39.tar.bz2
Further simplify gettmarg()
Diffstat (limited to 'Modules/timemodule.c')
-rw-r--r--Modules/timemodule.c24
1 files changed, 5 insertions, 19 deletions
diff --git a/Modules/timemodule.c b/Modules/timemodule.c
index d73b22b..4b45f6e 100644
--- a/Modules/timemodule.c
+++ b/Modules/timemodule.c
@@ -297,34 +297,20 @@ static int
gettmarg(PyObject *args, struct tm *p)
{
int y;
- PyObject *t = NULL;
memset((void *) p, '\0', sizeof(struct tm));
- if (PyTuple_Check(args)) {
- t = args;
- Py_INCREF(t);
- }
- else {
+ if (!PyTuple_Check(args)) {
PyErr_SetString(PyExc_TypeError,
"Tuple or struct_time argument required");
return 0;
}
- if (t == NULL || !PyArg_ParseTuple(t, "iiiiiiiii",
- &y,
- &p->tm_mon,
- &p->tm_mday,
- &p->tm_hour,
- &p->tm_min,
- &p->tm_sec,
- &p->tm_wday,
- &p->tm_yday,
- &p->tm_isdst)) {
- Py_XDECREF(t);
+ if (!PyArg_ParseTuple(args, "iiiiiiiii",
+ &y, &p->tm_mon, &p->tm_mday,
+ &p->tm_hour, &p->tm_min, &p->tm_sec,
+ &p->tm_wday, &p->tm_yday, &p->tm_isdst))
return 0;
- }
- Py_DECREF(t);
/* XXX: Why 1900? If the goal is to interpret 2-digit years as those in
* 20th / 21st century according to the POSIX standard, we can just treat