@@ -156,8 +156,7 @@ _DictRemover_call(PyObject *myself, PyObject *args, PyObject *kw)
156156 Py_CLEAR (self -> key );
157157 Py_CLEAR (self -> dict );
158158 }
159- Py_INCREF (Py_None );
160- return Py_None ;
159+ Py_RETURN_NONE ;
161160}
162161
163162static PyTypeObject DictRemover_Type = {
@@ -979,8 +978,7 @@ PyCPointerType_set_type(PyTypeObject *self, PyObject *type)
979978 if (-1 == PyDict_SetItemString ((PyObject * )dict , "_type_" , type ))
980979 return NULL ;
981980
982- Py_INCREF (Py_None );
983- return Py_None ;
981+ Py_RETURN_NONE ;
984982}
985983
986984static PyObject * _byref (PyObject * );
@@ -1496,8 +1494,7 @@ c_wchar_p_from_param(PyObject *type, PyObject *value)
14961494 PyObject * as_parameter ;
14971495 int res ;
14981496 if (value == Py_None ) {
1499- Py_INCREF (Py_None );
1500- return Py_None ;
1497+ Py_RETURN_NONE ;
15011498 }
15021499 if (PyUnicode_Check (value )) {
15031500 PyCArgObject * parg ;
@@ -1561,8 +1558,7 @@ c_char_p_from_param(PyObject *type, PyObject *value)
15611558 PyObject * as_parameter ;
15621559 int res ;
15631560 if (value == Py_None ) {
1564- Py_INCREF (Py_None );
1565- return Py_None ;
1561+ Py_RETURN_NONE ;
15661562 }
15671563 if (PyBytes_Check (value )) {
15681564 PyCArgObject * parg ;
@@ -1629,8 +1625,7 @@ c_void_p_from_param(PyObject *type, PyObject *value)
16291625
16301626/* None */
16311627 if (value == Py_None ) {
1632- Py_INCREF (Py_None );
1633- return Py_None ;
1628+ Py_RETURN_NONE ;
16341629 }
16351630 /* Should probably allow buffer interface as well */
16361631/* int, long */
@@ -2602,8 +2597,7 @@ PyCData_setstate(PyObject *myself, PyObject *args)
26022597 Py_DECREF (mydict );
26032598 if (res == -1 )
26042599 return NULL ;
2605- Py_INCREF (Py_None );
2606- return Py_None ;
2600+ Py_RETURN_NONE ;
26072601}
26082602
26092603/*
@@ -2825,8 +2819,7 @@ _PyCData_set(CDataObject *dst, PyObject *type, SETFUNC setfunc, PyObject *value,
28252819 return result ;
28262820 } else if (value == Py_None && PyCPointerTypeObject_Check (type )) {
28272821 * (void * * )ptr = NULL ;
2828- Py_INCREF (Py_None );
2829- return Py_None ;
2822+ Py_RETURN_NONE ;
28302823 } else {
28312824 PyErr_Format (PyExc_TypeError ,
28322825 "expected %s instance, got %s" ,
@@ -2980,8 +2973,7 @@ PyCFuncPtr_get_errcheck(PyCFuncPtrObject *self)
29802973 Py_INCREF (self -> errcheck );
29812974 return self -> errcheck ;
29822975 }
2983- Py_INCREF (Py_None );
2984- return Py_None ;
2976+ Py_RETURN_NONE ;
29852977}
29862978
29872979static int
@@ -3019,8 +3011,7 @@ PyCFuncPtr_get_restype(PyCFuncPtrObject *self)
30193011 Py_INCREF (dict -> restype );
30203012 return dict -> restype ;
30213013 } else {
3022- Py_INCREF (Py_None );
3023- return Py_None ;
3014+ Py_RETURN_NONE ;
30243015 }
30253016}
30263017
@@ -3057,8 +3048,7 @@ PyCFuncPtr_get_argtypes(PyCFuncPtrObject *self)
30573048 Py_INCREF (dict -> argtypes );
30583049 return dict -> argtypes ;
30593050 } else {
3060- Py_INCREF (Py_None );
3061- return Py_None ;
3051+ Py_RETURN_NONE ;
30623052 }
30633053}
30643054
0 commit comments