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

Skip to content
Merged
Show file tree
Hide file tree
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
Fix getargs argument passing
  • Loading branch information
hauntsaninja committed Dec 28, 2024
commit dd5d67d72901761fbfbac46d160dc0206625c88d
2 changes: 0 additions & 2 deletions mypyc/lib-rt/getargs.c
Original file line number Diff line number Diff line change
Expand Up @@ -374,8 +374,6 @@ vgetargskeywords(PyObject *args, PyObject *kwargs, const char *format,
int res = PyDict_GetItemStringRef(kwargs, kwlist[i], &current_arg);
if (res == 1) {
Py_DECREF(current_arg);
}
else if (unlikely(res == 0)) {
/* arg present in tuple and in dict */
PyErr_Format(PyExc_TypeError,
"argument for %.200s%s given by name ('%s') "
Expand Down
8 changes: 8 additions & 0 deletions mypyc/test-data/run-classes.test
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,14 @@ a = A(10)
assert a.foo() == 11
assert foo() == 21

[case testClassKwargs]
class X:
def __init__(self, msg: str, **variables: int) -> None:
pass
[file driver.py]
from native import X
X('hello', a=0)

[case testGenericClass]
from typing import TypeVar, Generic, Sequence
T = TypeVar('T')
Expand Down
Loading