Serhiy Storchaka added the comment:

It looks to me that PyDict_GetItemString(), PyObject_GetAttrString(), etc are 
mainly for backward compatibility and for using in performance non-critical 
code. Performance critical code caches string objects.

The only code that heavily used PyDict_GetItemString() was parsing keyword 
arguments in PyArg_ParseTupleAndKeywords(). But this API was replaced with more 
efficient _PyArg_ParseTupleAndKeywordsFast() and _PyArg_ParseStackAndKeywords() 
for internal use. I think something similar will be exposed as public API when 
it become enough mature. Issue29029 made PyArg_ParseTupleAndKeywords() much 
less using PyDict_GetItemString().

PyDict_GetItemString() can be used with non-ASCII C strings. They are decoded 
with UTF-8. The patch works incorrectly in this case.

I afraid that adding more and more specialized code in Objects/dictobject.c can 
slow down other functions in this file. And this makes the maintenance harder.

----------
nosy: +haypo, rhettinger, serhiy.storchaka

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue29295>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to