Bug report
/*[clinicinput]
function->NoneType
[clinicstartgeneratedcode]*/
will produce this function:
staticPyObject*function(PyObject*module, PyObject*Py_UNUSED(ignored))
{
returnfunction_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:
/*[clinicinput]
function->NoneTypea: int/
[clinicstartgeneratedcode]*/
staticPyObject*function(PyObject*module, PyObject*arg)
{
PyObject*return_value=NULL;
inta;
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:
returnreturn_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
Bug report
will produce this function:
while
function_implreturnsPy_None(as it should, if using NoneType return converter), refcount is not increased.here is a working example of NoneType return converter:
Generation also fails when generating a function with a single
objectparameter.It seems like the problem is with
default_return_converterin clinic.py, being set toTrue