Oleg Iarygin <o...@arhadthedev.net> added the comment:

> The function should return different values for success and error

It does, and a `void` return type enforces it. Here is the trick:

> An important convention throughout the Python interpreter is the following: 
> when a function fails, it should set an exception condition and return an 
> error value (usually -1 or a NULL pointer).
>
> - 
> https://docs.python.org/3/extending/extending.html#intermezzo-errors-and-exceptions

Previously, a function could return NULL but forget to call `PyErr_*()`.  With 
`void`, however, the function has no other choise but to properly set the error 
indicator so the Clinic's part will see it and return NULL finishing the 
convention.

----------

_______________________________________
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

Reply via email to