From: Stefan Behnel Date: Mon, 7 Jan 2013 19:08:22 +0000 (+0100) Subject: fix Unicode string initialisation in PyPy X-Git-Tag: 0.18b1~17 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=62335406348e1d887d4bea300d5279ae381d3034;p=platform%2Fupstream%2Fpython-cython.git fix Unicode string initialisation in PyPy --- diff --git a/Cython/Utility/StringTools.c b/Cython/Utility/StringTools.c index 11464c2..d124502 100644 --- a/Cython/Utility/StringTools.c +++ b/Cython/Utility/StringTools.c @@ -17,7 +17,11 @@ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { while (t->p) { #if PY_MAJOR_VERSION < 3 if (t->is_unicode) { +#if CYTHON_COMPILING_IN_PYPY + *t->p = PyUnicode_Decode(t->s, t->n - 1, "unicode-escape", NULL); +#else *t->p = PyUnicode_DecodeUnicodeEscape(t->s, t->n - 1, NULL); +#endif } else if (t->intern) { *t->p = PyString_InternFromString(t->s); } else { @@ -28,7 +32,11 @@ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { if (unlikely(t->encoding)) { *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL); } else { +#if CYTHON_COMPILING_IN_PYPY + *t->p = PyUnicode_Decode(t->s, t->n - 1, "unicode-escape", NULL); +#else *t->p = PyUnicode_DecodeUnicodeEscape(t->s, t->n - 1, NULL); +#endif } if (t->intern && likely(*t->p)) { PyUnicode_InternInPlace(t->p);