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)) {
#if PY_MAJOR_VERSION < 3 name = first_kw_arg;
if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) { while (*name && (**name != key)) name++;
#else if (*name) {
if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key))) { values[name-argnames] = value;
#endif
goto invalid_keyword_type;
} else { } else {
name = argnames; #if PY_MAJOR_VERSION < 3
while (*name && (**name != key)) name++; if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) {
if (*name) { #else
if (name < first_kw_arg) goto arg_passed_twice; if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key))) {
values[name-argnames] = value; #endif
goto invalid_keyword_type;
} 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