[Python-checkins] cpython: Another temporary hack to debug the issue #13441

victor.stinner python-checkins at python.org
Mon Nov 21 15:40:51 CET 2011


http://hg.python.org/cpython/rev/d1b3b1d00811
changeset:   73662:d1b3b1d00811
user:        Victor Stinner <vstinner at wyplay.com>
date:        Mon Nov 21 15:41:17 2011 +0100
summary:
  Another temporary hack to debug the issue #13441

Dump the wchar_t that we are going to decode and dump the locale

files:
  Modules/_localemodule.c |  20 ++++++++++++++++++++
  1 files changed, 20 insertions(+), 0 deletions(-)


diff --git a/Modules/_localemodule.c b/Modules/_localemodule.c
--- a/Modules/_localemodule.c
+++ b/Modules/_localemodule.c
@@ -73,6 +73,20 @@
 #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)
         PyMem_Free(dest);
@@ -160,12 +174,18 @@
 
     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;

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


More information about the Python-checkins mailing list