You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Argument Clinic does not increase NoneType refcount when returning NoneType from a function with no parameters #95007
Good catch. This converter is not used, so the bug was not exposed. And since it has dubious semantic (requires returning a weak reference to None on success), I think that it is better to remove it.
How about we'll get rid of the callback return value, and use PyErr_Occurred() to chose whether to return NULL or Py_None?
When I did the same in gh-91284, I found that PyErr_Occurred takes GIL. Currently (until nogil is implemented, at least) it's cheaper to deal with PyErr_Occurred only on NULL returned from a callback.
Activity
pythongh-95007: Remove the NoneType return converter
serhiy-storchaka commentedon Jul 19, 2022
Good catch. This converter is not used, so the bug was not exposed. And since it has dubious semantic (requires returning a weak reference to None on success), I think that it is better to remove it.
noamcohen97 commentedon Jul 19, 2022
How about we'll get rid of the callback return value, and use
PyErr_Occurred()to chose whether to returnNULLorPy_None?arhadthedev commentedon Jul 19, 2022
When I did the same in gh-91284, I found that
PyErr_Occurredtakes GIL. Currently (until nogil is implemented, at least) it's cheaper to deal withPyErr_Occurredonly onNULLreturned from a callback.gh-95007: Remove the NoneType return converter (GH-95019)
gh-95007: Remove the NoneType return converter from Argument Clinic D…
erlend-aasland commentedon Aug 1, 2022
Resolved with:
python/cpython#95007: Remove the NoneType return converter from Argum…
python/cpython#95007: Remove the NoneType return converter from Argum…