Message285633
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. |
|
Date |
User |
Action |
Args |
2017-01-17 11:54:56 | serhiy.storchaka | set | recipients:
+ serhiy.storchaka, rhettinger, vstinner, methane |
2017-01-17 11:54:56 | serhiy.storchaka | set | messageid: <1484654096.62.0.464246999195.issue29295@psf.upfronthosting.co.za> |
2017-01-17 11:54:56 | serhiy.storchaka | link | issue29295 messages |
2017-01-17 11:54:56 | serhiy.storchaka | create | |
|