]> granicus.if.org Git - python/commitdiff
Another temporary hack to debug the issue #13441
authorVictor Stinner <vstinner@wyplay.com>
Mon, 21 Nov 2011 14:41:17 +0000 (15:41 +0100)
committerVictor Stinner <vstinner@wyplay.com>
Mon, 21 Nov 2011 14:41:17 +0000 (15:41 +0100)
Dump the wchar_t that we are going to decode and dump the locale

Modules/_localemodule.c

index 236442f05bc459e1ad2ae0b5e9aa69303017f9c5..6a751d6187534a6bab1bb4e463abcc86866c9fc7 100644 (file)
@@ -72,6 +72,20 @@ str2uni(const char* s)
     assert(res1 != (size_t)-1);
 #else
     assert(res1 == needed);
+#endif
+#ifdef Py_DEBUG
+    {
+        size_t i;
+        printf("Decode wchar_t {");
+        for (i=0; i<res1; i++) {
+            wchar_t ch = dest[i];
+            if (i)
+                printf(" U+%04x", ch);
+            else
+                printf("U+%04x", ch);
+        }
+        printf("} (len=%u)\n", res1);
+    }
 #endif
     res2 = PyUnicode_FromWideChar(dest, res1);
     if (dest != smallbuf)
@@ -160,12 +174,18 @@ PyLocale_setlocale(PyObject* self, PyObject* args)
 
     if (locale) {
         /* set locale */
+#ifdef Py_DEBUG
+        printf("SET LOCALE \"%s\"\n", locale);
+#endif
         result = setlocale(category, locale);
         if (!result) {
             /* operation failed, no setting was changed */
             PyErr_SetString(Error, "unsupported locale setting");
             return NULL;
         }
+#ifdef Py_DEBUG
+        printf("SET LOCALE -> %s\n", result);
+#endif
         result_object = str2uni(result);
         if (!result_object)
             return NULL;