New submission from Oleg Iarygin <o...@arhadthedev.net>:
The attached PR makes the following possible (note that the impl has a `void` return type): /*[clinic input] _io._IOBase.writelines -> NoneType lines: object / [clinic start generated code]*/ static void _io__IOBase_writelines_impl(PyObject *self, PyObject *lines) /*[clinic end generated code: output=f3feca36db72dbd1 input=286ba711cb7291ad]*/ Previously, the return type would be `Object *` with generated replacement of non-Py_None values to NULL on the other side. So now there is no need to track whether NULL or Py_None should be returned. Or should it be Py_RETURN_NONE? Argument Clinic does it by itself returning NULL on errors and PyNone otherwise: static PyObject * _io__IOBase_writelines(PyObject *self, PyObject *lines) { PyObject *return_value = NULL; _io__IOBase_writelines_impl(self, lines); if (PyErr_Occurred()) { goto exit; } return_value = Py_None; Py_INCREF(Py_None); exit: return return_value; } ---------- components: Argument Clinic messages: 416062 nosy: arhadthedev, larry priority: normal severity: normal status: open title: Enhance Argument Clinic's NoneType return converter to give `void` type: enhancement versions: Python 3.11 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue47128> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com