changeset: 72949:977c5753ca32 branch: 3.2 parent: 72943:8365f82f8a13 user: Victor Stinner date: Sun Oct 16 23:45:39 2011 +0200 files: Modules/timemodule.c description: Issue #10653: Fix time.strftime() on Windows, check for invalid format strings diff -r 8365f82f8a13 -r 977c5753ca32 Modules/timemodule.c --- a/Modules/timemodule.c Sat Oct 15 23:50:42 2011 -0700 +++ b/Modules/timemodule.c Sun Oct 16 23:45:39 2011 +0200 @@ -508,16 +508,16 @@ fmt = PyBytes_AS_STRING(format); #endif -#if defined(MS_WINDOWS) && defined(HAVE_WCSFTIME) +#if defined(MS_WINDOWS) /* check that the format string contains only valid directives */ - for(outbuf = wcschr(fmt, L'%'); + for(outbuf = strchr(fmt, '%'); outbuf != NULL; - outbuf = wcschr(outbuf+2, L'%')) + outbuf = strchr(outbuf+2, '%')) { if (outbuf[1]=='#') ++outbuf; /* not documented by python, */ if (outbuf[1]=='0円' || - !wcschr(L"aAbBcdHIjmMpSUwWxXyYzZ%", outbuf[1])) + !strchr("aAbBcdHIjmMpSUwWxXyYzZ%", outbuf[1])) { PyErr_SetString(PyExc_ValueError, "Invalid format string"); return 0;

AltStyle によって変換されたページ (->オリジナル) /