gh-110815: Support non-ASCII keyword names in PyArg_ParseTupleAndKeywords() (GH-110816)

It already mostly worked, except in the case when invalid keyword
argument with non-ASCII name was passed to function with non-ASCII
parameter names. Then it crashed in the debug mode.
This commit is contained in:
Serhiy Storchaka 2023-10-14 08:50:03 +03:00 committed by GitHub
parent ce298a1c15
commit 7284e0ef84
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 64 additions and 3 deletions

View file

@ -1729,7 +1729,7 @@ vgetargskeywords(PyObject *args, PyObject *kwargs, const char *format,
return cleanreturn(0, &freelist);
}
for (i = pos; i < len; i++) {
if (_PyUnicode_EqualToASCIIString(key, kwlist[i])) {
if (PyUnicode_EqualToUTF8(key, kwlist[i])) {
match = 1;
break;
}