[capi-sig] Is it ok to call PyBaseType_Object.tp_new from external code?

Łukasz Jagielski lukaszjagielski at gmail.com
Tue Oct 3 11:04:13 EDT 2017

I've noticed that when calling PyBaseObject_Type.tp_new (
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?

More information about the capi-sig mailing list