diff options
author | Victor Stinner <victor.stinner@haypocalc.com> | 2011-11-21 13:31:41 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@haypocalc.com> | 2011-11-21 13:31:41 (GMT) |
commit | da29cc36aa2c7dcc3932ea1d83e261aa940ccdb4 (patch) | |
tree | 25809c9e42e05177422ea007fa2da3d0cf46a152 /Modules/_localemodule.c | |
parent | a996f1e1a05c96e449aabb7fa77e5128417ce7e0 (diff) | |
download | cpython-da29cc36aa2c7dcc3932ea1d83e261aa940ccdb4.zip cpython-da29cc36aa2c7dcc3932ea1d83e261aa940ccdb4.tar.gz cpython-da29cc36aa2c7dcc3932ea1d83e261aa940ccdb4.tar.bz2 |
Issue #13441: _PyUnicode_CheckConsistency() dumps the string if the maximum
character is bigger than U+10FFFF and locale.localeconv() dumps the string
before decoding it.
Temporary hack to debug the issue #13441.
Diffstat (limited to 'Modules/_localemodule.c')
-rw-r--r-- | Modules/_localemodule.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/Modules/_localemodule.c b/Modules/_localemodule.c index 9bba1b3..236442f 100644 --- a/Modules/_localemodule.c +++ b/Modules/_localemodule.c @@ -79,6 +79,23 @@ str2uni(const char* s) return res2; } +#ifdef Py_DEBUG +void +dump_str(const char *name, const char *value) +{ + size_t i, len = strlen(value); + printf("Decode localeconv() %s: {", name); + for (i=0; i<len; i++) { + unsigned char ch = value[i]; + if (i) + printf(" 0x%02x", ch); + else + printf("0x%02x", ch); + } + printf("} (len=%u)\n", len); +} +#endif + /* support functions for formatting floating point numbers */ PyDoc_STRVAR(setlocale__doc__, @@ -184,11 +201,20 @@ PyLocale_localeconv(PyObject* self) /* hopefully, the localeconv result survives the C library calls involved herein */ +#ifdef Py_DEBUG +#define RESULT_STRING(s)\ + dump_str(#s, l->s); \ + x = str2uni(l->s); \ + if (!x) goto failed;\ + PyDict_SetItemString(result, #s, x);\ + Py_XDECREF(x) +#else #define RESULT_STRING(s)\ x = str2uni(l->s); \ if (!x) goto failed;\ PyDict_SetItemString(result, #s, x);\ Py_XDECREF(x) +#endif #define RESULT_INT(i)\ x = PyLong_FromLong(l->i);\ |