diff options
author | Guido van Rossum <guido@python.org> | 1997-02-14 16:35:10 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1997-02-14 16:35:10 (GMT) |
commit | a78bfe198565e25148b57a58fc5bec01ada8f6ab (patch) | |
tree | 23375e534601661725a5e6387a2811609e81a9d6 /Modules/timemodule.c | |
parent | 0d85be19e29788d6221295e8910f5d9a671eac85 (diff) | |
download | cpython-a78bfe198565e25148b57a58fc5bec01ada8f6ab.zip cpython-a78bfe198565e25148b57a58fc5bec01ada8f6ab.tar.gz cpython-a78bfe198565e25148b57a58fc5bec01ada8f6ab.tar.bz2 |
Issue a more meaningful error if strftime keeps returning a NULL pointer.
Run the loop up to and including 8k.
Diffstat (limited to 'Modules/timemodule.c')
-rw-r--r-- | Modules/timemodule.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/Modules/timemodule.c b/Modules/timemodule.c index b9f0c49..1f55933 100644 --- a/Modules/timemodule.c +++ b/Modules/timemodule.c @@ -242,7 +242,7 @@ time_strftime(self, args) /* I hate these functions that presume you know how big the output * will be ahead of time... */ - for (i = 1024 ; i < 8192 ; i += 1024) { + for (i = 1024 ; i <= 8192 ; i += 1024) { outbuf = malloc(i); if (outbuf == NULL) { return PyErr_NoMemory(); @@ -255,7 +255,9 @@ time_strftime(self, args) } free(outbuf); } - return PyErr_NoMemory(); + PyErr_SetString(PyExc_ValueError, + "bad strftime format or result too big"); + return NULL; } #endif /* HAVE_STRFTIME */ @@ -443,6 +445,7 @@ floatsleep(double secs) double secs; #endif /* MPW */ { +/* XXX Should test for MS_WIN32 first! */ #ifdef HAVE_SELECT struct timeval t; double frac; |