03.10.17 18:04, Łukasz Jagielski пише:
I've noticed that when calling PyBaseObject_Type.tp_new ( https://github.com/python/cpython/blob/master/Objects/typeobject.c#L3608), function excess_args is immediately called which assumes its first parameter is a tuple. Problem is that tuple struct is bigger that Py_None, correct me if I'm wrong. I've noticed code in swig which calls object_new with both args and kwds being Py_None and reported an issue for it (https://github.com/swig/swig/issues/1109). The question is whether it's ok to call tp_new on a given PyTypeObject but the second and third param should always be a tuple and a dict or should some other api function be called instead?
args should be a tuple, kwds should be NULL or a dict.