Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
[mypyc] Replace deprecated _PyDict_GetItemStringWithError
  • Loading branch information
cdce8p committed Oct 13, 2024
commit e27c2abca1b87d4448310d7c26a1b6dcf993640e
12 changes: 6 additions & 6 deletions mypyc/lib-rt/getargs.c
Original file line number Diff line number Diff line change
Expand Up @@ -250,11 +250,11 @@ vgetargskeywords(PyObject *args, PyObject *kwargs, const char *format,
current_arg = PyTuple_GET_ITEM(args, i);
}
else if (nkwargs && i >= pos) {
current_arg = _PyDict_GetItemStringWithError(kwargs, kwlist[i]);
if (current_arg) {
int res = PyDict_GetItemStringRef(kwargs, kwlist[i], &current_arg);
if (res == 1) {
--nkwargs;
}
else if (PyErr_Occurred()) {
else if (res == -1) {
return 0;
}
}
Expand Down Expand Up @@ -370,8 +370,8 @@ vgetargskeywords(PyObject *args, PyObject *kwargs, const char *format,
Py_ssize_t j;
/* make sure there are no arguments given by name and position */
for (i = pos; i < bound_pos_args && i < len; i++) {
current_arg = _PyDict_GetItemStringWithError(kwargs, kwlist[i]);
if (unlikely(current_arg != NULL)) {
int res = PyDict_GetItemStringRef(kwargs, kwlist[i], &current_arg);
if (unlikely(res == 0)) {
/* arg present in tuple and in dict */
PyErr_Format(PyExc_TypeError,
"argument for %.200s%s given by name ('%s') "
Expand All @@ -381,7 +381,7 @@ vgetargskeywords(PyObject *args, PyObject *kwargs, const char *format,
kwlist[i], i+1);
goto latefail;
}
else if (unlikely(PyErr_Occurred() != NULL)) {
else if (unlikely(res == -1)) {
goto latefail;
}
}
Expand Down
Loading