[Python-Dev] cpython: Simplify the code of get_attrib_from_keywords somewhat.

Eli Bendersky eliben at gmail.com
Mon Apr 22 20:03:01 CEST 2013


On Mon, Apr 22, 2013 at 10:13 AM, Serhiy Storchaka <storchaka at 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 at 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20130422/20d05c1b/attachment.html>


More information about the Python-Dev mailing list