Re: [Python-Dev] cpython: Simplify the code of get_attrib_from_keywords somewhat.
On 22.04.13 15:52, eli.bendersky wrote:
http://hg.python.org/cpython/rev/c9674421d78e changeset: 83494:c9674421d78e user: Eli Bendersky <eliben@gmail.com> date: Mon Apr 22 05:52:16 2013 -0700 summary: Simplify the code of get_attrib_from_keywords somewhat.
- PyDict_DelItem(kwds, attrib_str); + PyDict_DelItemString(kwds, ATTRIB_KEY);
PyDict_GetItemString() and PyDict_DelItemString() internally create a Python string. I.e. new code creates one additional string if attrib was found in kwds.
- if (attrib) - PyDict_Update(attrib, kwds); + assert(attrib);
attrib can be NULL in case of memory allocation error.
On Mon, Apr 22, 2013 at 10:13 AM, Serhiy Storchaka <storchaka@gmail.com>wrote:
On 22.04.13 15:52, eli.bendersky wrote:
http://hg.python.org/cpython/**rev/c9674421d78e<http://hg.python.org/cpython/rev/c9674421d78e> changeset: 83494:c9674421d78e user: Eli Bendersky <eliben@gmail.com> date: Mon Apr 22 05:52:16 2013 -0700 summary: Simplify the code of get_attrib_from_keywords somewhat.
- PyDict_DelItem(kwds, attrib_str);
+ PyDict_DelItemString(kwds, ATTRIB_KEY);
PyDict_GetItemString() and PyDict_DelItemString() internally create a Python string. I.e. new code creates one additional string if attrib was found in kwds.
- if (attrib)
- PyDict_Update(attrib, kwds); + assert(attrib);
attrib can be NULL in case of memory allocation error.
Thanks, I'll review this Eli
participants (2)
-
Eli Bendersky
-
Serhiy Storchaka