[Python-checkins] python/dist/src/Modules timemodule.c,2.137,2.138
bcannon@users.sourceforge.net
bcannon@users.sourceforge.net
Mon, 30 Jun 2003 22:16:10 -0700
Update of /cvsroot/python/python/dist/src/Modules
In directory sc8-pr-cvs1:/tmp/cvs-serv13084/Modules
Modified Files:
timemodule.c
Log Message:
Make temporary change of using _strptime for time.strptime permanent.
Flesh out docs to better explain time.strptime (closes bug #697990).
Index: timemodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/timemodule.c,v
retrieving revision 2.137
retrieving revision 2.138
diff -C2 -d -r2.137 -r2.138
*** timemodule.c 10 May 2003 07:36:55 -0000 2.137
--- timemodule.c 1 Jul 2003 05:16:08 -0000 2.138
***************
*** 417,458 ****
#endif /* HAVE_STRFTIME */
- #undef HAVE_STRPTIME
- #ifdef HAVE_STRPTIME
-
- #if 0
- /* Enable this if it's not declared in <time.h> */
- extern char *strptime(const char *, const char *, struct tm *);
- #endif
-
- static PyObject *
- time_strptime(PyObject *self, PyObject *args)
- {
- struct tm tm;
- char *fmt = "%a %b %d %H:%M:%S %Y";
- char *buf;
- char *s;
-
- if (!PyArg_ParseTuple(args, "s|s:strptime", &buf, &fmt))
- return NULL;
- memset((void *) &tm, '\0', sizeof(tm));
- s = strptime(buf, fmt, &tm);
- if (s == NULL) {
- PyErr_SetString(PyExc_ValueError, "format mismatch");
- return NULL;
- }
- while (*s && isspace(Py_CHARMASK(*s)))
- s++;
- if (*s) {
- PyErr_Format(PyExc_ValueError,
- "unconverted data remains: '%.400s'", s);
- return NULL;
- }
- return tmtotuple(&tm);
- }
-
- #endif /* HAVE_STRPTIME */
-
- #ifndef HAVE_STRPTIME
-
static PyObject *
time_strptime(PyObject *self, PyObject *args)
--- 417,420 ----
***************
*** 468,475 ****
}
- #endif /* !HAVE_STRPTIME */
-
PyDoc_STRVAR(strptime_doc,
! "strptime(string, format) -> tuple\n\
\n\
Parse a string to a time tuple according to a format specification.\n\
--- 430,435 ----
}
PyDoc_STRVAR(strptime_doc,
! "strptime(string, format) -> struct_time\n\
\n\
Parse a string to a time tuple according to a format specification.\n\