[Python-checkins] cpython (merge 3.2 -> default): Issue #10951: Fix compiler warnings in timemodule.c and unicodeobject.c

victor.stinner python-checkins at python.org
Sat Dec 17 22:38:29 CET 2011


http://hg.python.org/cpython/rev/49b85dba251d
changeset:   74016:49b85dba251d
parent:      74014:7876cd49300d
parent:      74015:d7862e855274
user:        Victor Stinner <victor.stinner at haypocalc.com>
date:        Sat Dec 17 22:39:43 2011 +0100
summary:
  Issue #10951: Fix compiler warnings in timemodule.c and unicodeobject.c

Thanks Jérémy Anger for the fix.

files:
  Modules/timemodule.c    |  4 ++++
  Objects/unicodeobject.c |  2 +-
  2 files changed, 5 insertions(+), 1 deletions(-)


diff --git a/Modules/timemodule.c b/Modules/timemodule.c
--- a/Modules/timemodule.c
+++ b/Modules/timemodule.c
@@ -515,14 +515,18 @@
      * will be ahead of time...
      */
     for (i = 1024; ; i += i) {
+#if defined _MSC_VER && _MSC_VER >= 1400 && defined(__STDC_SECURE_LIB__)
         int err;
+#endif
         outbuf = (time_char *)PyMem_Malloc(i*sizeof(time_char));
         if (outbuf == NULL) {
             PyErr_NoMemory();
             break;
         }
         buflen = format_time(outbuf, i, fmt, &buf);
+#if defined _MSC_VER && _MSC_VER >= 1400 && defined(__STDC_SECURE_LIB__)
         err = errno;
+#endif
         if (buflen > 0 || i >= 256 * fmtlen) {
             /* If the buffer is 256 times as long as the format,
                it's probably not failing for lack of room!
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -4832,7 +4832,7 @@
     if (maxchar < 128 && size == unicode_size) {
         if (consumed)
             *consumed = size;
-        return unicode_fromascii(s, size);
+        return unicode_fromascii((const unsigned char *)s, size);
     }
 
     unicode = PyUnicode_New(unicode_size, maxchar);

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list