This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author seberg
Recipients seberg
Date 2019-12-12.04:04:55
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1576123495.69.0.334207747364.issue39028@roundup.psfhosted.org>
In-reply-to
Content
The keyword argument extraction/finding function seems to have a performance bug/enhancement (unless I am missing something here). It reads:


```
    for (i=0; i < nkwargs; i++) {
        PyObject *kwname = PyTuple_GET_ITEM(kwnames, i);

        /* ptr==ptr should match in most cases since keyword keys
           should be interned strings */
        if (kwname == key) {
            return kwstack[i];
        }
        assert(PyUnicode_Check(kwname));
        if (_PyUnicode_EQ(kwname, key)) {
            return kwstack[i];
        }
    }
```

However, it should be split into two separate for loops, using the `PyUnicode_EQ` check only if it failed for _all_ other arguments.

I will open a PR for this (it seemed like a bpo number is wanted for almost everything.
History
Date User Action Args
2019-12-12 04:04:55sebergsetrecipients: + seberg
2019-12-12 04:04:55sebergsetmessageid: <1576123495.69.0.334207747364.issue39028@roundup.psfhosted.org>
2019-12-12 04:04:55seberglinkissue39028 messages
2019-12-12 04:04:55sebergcreate