Skip to content

Commit dd5d67d

Browse files
committed
Fix getargs argument passing
Fixes mypyc/mypyc#1078 See python#17930
1 parent ec04f73 commit dd5d67d

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

mypyc/lib-rt/getargs.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -374,8 +374,6 @@ vgetargskeywords(PyObject *args, PyObject *kwargs, const char *format,
374374
int res = PyDict_GetItemStringRef(kwargs, kwlist[i], &current_arg);
375375
if (res == 1) {
376376
Py_DECREF(current_arg);
377-
}
378-
else if (unlikely(res == 0)) {
379377
/* arg present in tuple and in dict */
380378
PyErr_Format(PyExc_TypeError,
381379
"argument for %.200s%s given by name ('%s') "

mypyc/test-data/run-classes.test

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -467,6 +467,14 @@ a = A(10)
467467
assert a.foo() == 11
468468
assert foo() == 21
469469

470+
[case testClassKwargs]
471+
class X:
472+
def __init__(self, msg: str, **variables: int) -> None:
473+
pass
474+
[file driver.py]
475+
from native import X
476+
X('hello', a=0)
477+
470478
[case testGenericClass]
471479
from typing import TypeVar, Generic, Sequence
472480
T = TypeVar('T')

0 commit comments

Comments
 (0)