diff --git a/developer-workflow/c-api.rst b/developer-workflow/c-api.rst index 103abe7b0..7b727a735 100644 --- a/developer-workflow/c-api.rst +++ b/developer-workflow/c-api.rst @@ -110,9 +110,11 @@ Guidelines for expanding/changing the public API fields, arguments and return values are well defined. - Functions returning ``PyObject *`` must return a valid pointer on success, - and ``NULL`` with an exception raised on error. - Most other API must return ``-1`` with an exception raised on error, - and ``0`` on success. + and ``NULL`` if and only if an exception is raised. + Other API must return an ``int``: return ``0`` on success, + and a negative value if and only if an exception is raised. + ``-1`` should be used as the error value; + the caller should use the C idiom ``if (func() < 0)`` to check for errors. - APIs with lesser and greater results must return ``0`` for the lesser result, and ``1`` for the greater result.