Bug report
/ * [clinic input ]
function -> NoneType
[clinic start generated code ]* /
will produce this function:
static PyObject *
function (PyObject * module , PyObject * Py_UNUSED (ignored ))
{
return function_impl (module );
}
while function_impl returns Py_None (as it should, if using NoneType return converter), refcount is not increased.
here is a working example of NoneType return converter:
/ * [clinic input ]
function -> NoneType
a : int
/
[clinic start generated code ]* /
static PyObject *
function (PyObject * module , PyObject * arg )
{
PyObject * return_value = NULL ;
int a ;
PyObject * _return_value ;
a = _PyLong_AsInt (arg );
if (a == -1 && PyErr_Occurred ()) {
goto exit ;
}
_return_value = function_impl (module , a );
if (_return_value != Py_None ) {
goto exit ;
}
return_value = Py_None ;
Py_INCREF (Py_None );
exit :
return return_value ;
}
Generation also fails when generating a function with a single object parameter.
It seems like the problem is with default_return_converter in clinic.py, being set to True
👍 React with 👍 1hauntsaninja