[issue47128] Enhance Argument Clinic's NoneType return converter to give `void`

2022-03-28 Thread Oleg Iarygin
Oleg Iarygin added the comment: Actually, you're right. For now, PyErr_Occurred is a GIL lock plus a memory access. While the access is cheap because of a L1 cache hit, the GIL takes its toll in a hot path. So I'm closing the PR until GIL removal is done so no performance penalty will be

[issue47128] Enhance Argument Clinic's NoneType return converter to give `void`

2022-03-27 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: It is simpler and faster to return NULL than call PyErr_Occurred(). There is a special macro PY_RETURN_NONE, so there is no problem with returning None either. I do not think it would make the code better. -- resolution: -> rejected stage: patch

[issue47128] Enhance Argument Clinic's NoneType return converter to give `void`

2022-03-26 Thread Oleg Iarygin
Oleg Iarygin 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

[issue47128] Enhance Argument Clinic's NoneType return converter to give `void`

2022-03-26 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: The function should return different values for success and error. Functions which do not do this have bad design. -- nosy: +serhiy.storchaka ___ Python tracker

[issue47128] Enhance Argument Clinic's NoneType return converter to give `void`

2022-03-26 Thread Oleg Iarygin
Change by Oleg Iarygin : -- keywords: +patch pull_requests: +30205 stage: -> patch review pull_request: https://github.com/python/cpython/pull/32126 ___ Python tracker ___

[issue47128] Enhance Argument Clinic's NoneType return converter to give `void`

2022-03-26 Thread Oleg Iarygin
New submission from Oleg Iarygin : 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