@@ -250,13 +250,12 @@ vgetargskeywords(PyObject *args, PyObject *kwargs, const char *format,
250250 current_arg = Py_NewRef (PyTuple_GET_ITEM (args , i ));
251251 }
252252 else if (nkwargs && i >= pos ) {
253- int res = PyDict_GetItemStringRef (kwargs , kwlist [i ], & current_arg );
254- if (res == 1 ) {
255- -- nkwargs ;
256- }
257- else if (res == -1 ) {
253+ if (PyDict_GetItemStringRef (kwargs , kwlist [i ], & current_arg ) < 0 ) {
258254 return 0 ;
259255 }
256+ if (current_arg ) {
257+ -- nkwargs ;
258+ }
260259 }
261260 else {
262261 current_arg = NULL ;
@@ -371,8 +370,11 @@ vgetargskeywords(PyObject *args, PyObject *kwargs, const char *format,
371370 Py_ssize_t j ;
372371 /* make sure there are no arguments given by name and position */
373372 for (i = pos ; i < bound_pos_args && i < len ; i ++ ) {
374- int res = PyDict_GetItemStringRef (kwargs , kwlist [i ], & current_arg );
375- if (res == 1 ) {
373+ PyObject * current_arg ;
374+ if (PyDict_GetItemStringRef (kwargs , kwlist [i ], & current_arg ) < 0 ) {
375+ goto latefail ;
376+ }
377+ if (unlikely (current_arg != NULL )) {
376378 Py_DECREF (current_arg );
377379 /* arg present in tuple and in dict */
378380 PyErr_Format (PyExc_TypeError ,
@@ -383,9 +385,6 @@ vgetargskeywords(PyObject *args, PyObject *kwargs, const char *format,
383385 kwlist [i ], i + 1 );
384386 goto latefail ;
385387 }
386- else if (unlikely (res == -1 )) {
387- goto latefail ;
388- }
389388 }
390389 /* make sure there are no extraneous keyword arguments */
391390 j = 0 ;
0 commit comments