20.06.19 19:28, Victor Stinner пише:
Le jeu. 20 juin 2019 à 11:15, Inada Naoki <[email protected]> a écrit :
Can we change _PyUnicode_FromId to use _PyUnicode_FromASCII?

How would a developer detect a mistake (non-ASCII) character? Does
_PyUnicode_FromASCII() raise an exception, even in release mode?

The function is only called once (that's the whole purpose of the
Py_IDENTIFER() API. Is it really worth it?

I concur with Victor. The initialization code of the _Py_IDENTIFER API is not not performance sensitive.

And looking on the cases where _PyUnicode_FromASCII is used currently, I think that we can get rid of _PyUnicode_FromASCII in most of them for performance reasons. For example, when format a complex we first create two dynamically allocated 8-bit buffers in PyOS_double_to_string, then convert them to Unicode objects using _PyUnicode_FromASCII, then parse them, then build the final result in several steps using the _PyUnicodeWriter API. I think it can be done in more optimal way.

So it may be that we will remove _PyUnicode_FromASCII at end.
_______________________________________________
Python-Dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/[email protected]/message/KAORN7DBHUT5OHAYC7DH24XNVH2T6Q5Y/

Reply via email to