I realize that _Py_Identifier is a private name, and that PEP 3131 requires anything (except test cases) in the standard library to stick with ASCII ... but somehow, that feels like too long of a chain. I would prefer to see _Py_Identifier renamed to _Py_ASCII_Identifier, or at least a comment stating that Identifiers will (per PEP 3131) always be ASCII -- preferably with an assert to back that up. -jJ On Sat, Feb 4, 2012 at 7:46 PM, victor.stinner <python-checkins@python.org> wrote:
http://hg.python.org/cpython/rev/d2c1521ad0a1 changeset: 74772:d2c1521ad0a1 user: Victor Stinner <victor.stinner@haypocalc.com> date: Sun Feb 05 01:45:45 2012 +0100 summary: _Py_Identifier are always ASCII strings
files: Objects/unicodeobject.c | 5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -1744,9 +1744,8 @@ _PyUnicode_FromId(_Py_Identifier *id) { if (!id->object) { - id->object = PyUnicode_DecodeUTF8Stateful(id->string, - strlen(id->string), - NULL, NULL); + id->object = unicode_fromascii((unsigned char*)id->string, + strlen(id->string)); if (!id->object) return NULL; PyUnicode_InternInPlace(&id->object);
-- Repository URL: http://hg.python.org/cpython