]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-95007: Remove the NoneType return converter (GH-95019)
authorSerhiy Storchaka <storchaka@gmail.com>
Wed, 20 Jul 2022 05:42:02 +0000 (08:42 +0300)
committerGitHub <noreply@github.com>
Wed, 20 Jul 2022 05:42:02 +0000 (08:42 +0300)
It has confusing semantic which does not provide any benefit (the
only difference is that you should write "return Py_None" instead
of "Py_RETURN_NONE"), it is not currently used, and it is broken.

Tools/clinic/clinic.py

index 0041363c46be2fb97df75ee74085120c74adb02a..36bfc7050507e560262812bbb5c41285a03dddc0 100755 (executable)
@@ -3826,17 +3826,6 @@ class CReturnConverter(metaclass=CReturnConverterAutoRegister):
 
 add_c_return_converter(CReturnConverter, 'object')
 
-class NoneType_return_converter(CReturnConverter):
-    def render(self, function, data):
-        self.declare(data)
-        data.return_conversion.append('''
-if (_return_value != Py_None) {
-    goto exit;
-}
-return_value = Py_None;
-Py_INCREF(Py_None);
-'''.strip())
-
 class bool_return_converter(CReturnConverter):
     type = 'int'