Commit 8839d75a authored by Stefan Behnel's avatar Stefan Behnel

be more optimistic when parsing optional keywords: if (interned) string...

be more optimistic when parsing optional keywords: if (interned) string pointers are identical, we know it's the right type of object
parent 7a76ae3e
...@@ -4961,18 +4961,17 @@ static int __Pyx_ParseOptionalKeywords( ...@@ -4961,18 +4961,17 @@ static int __Pyx_ParseOptionalKeywords(
PyObject*** first_kw_arg = argnames + num_pos_args; PyObject*** first_kw_arg = argnames + num_pos_args;
while (PyDict_Next(kwds, &pos, &key, &value)) { while (PyDict_Next(kwds, &pos, &key, &value)) {
name = first_kw_arg;
while (*name && (**name != key)) name++;
if (*name) {
values[name-argnames] = value;
} else {
#if PY_MAJOR_VERSION < 3 #if PY_MAJOR_VERSION < 3
if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) { if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) {
#else #else
if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key))) { if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key))) {
#endif #endif
goto invalid_keyword_type; goto invalid_keyword_type;
} else {
name = argnames;
while (*name && (**name != key)) name++;
if (*name) {
if (name < first_kw_arg) goto arg_passed_twice;
values[name-argnames] = value;
} else { } else {
for (name = first_kw_arg; *name; name++) { for (name = first_kw_arg; *name; name++) {
#if PY_MAJOR_VERSION >= 3 #if PY_MAJOR_VERSION >= 3
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment