[Python-Dev] Is this safe enough? Re: [Python-checkins] cpython: _Py_Identifier are always ASCII strings

Antoine Pitrou solipsis at pitrou.net
Mon Feb 6 22:59:36 CET 2012


On Mon, 6 Feb 2012 22:57:46 +0100
Victor Stinner <victor.stinner at haypocalc.com> wrote:
> 
> >> -        id->object = PyUnicode_DecodeUTF8Stateful(id->string,
> >> -                                                  strlen(id->string),
> >> -                                                  NULL, NULL);
> >> +        id->object = unicode_fromascii((unsigned char*)id->string,
> >> +                                       strlen(id->string));
> 
> This is just an optimization.

Is the optimization even worthwhile? This code is typically called once
for every static string.

Regards

Antoine.




More information about the Python-Dev mailing list