[Python-checkins] cpython: Utilize Py_RETURN_NONE in _tkinter module.

andrew.svetlov python-checkins at python.org
Sun Oct 7 11:08:48 CEST 2012


http://hg.python.org/cpython/rev/c4e39d4584f2
changeset:   79562:c4e39d4584f2
user:        Andrew Svetlov <andrew.svetlov at gmail.com>
date:        Sun Oct 07 12:08:38 2012 +0300
summary:
  Utilize Py_RETURN_NONE in _tkinter module.

files:
  Modules/_tkinter.c |  39 +++++++++++----------------------
  1 files changed, 13 insertions(+), 26 deletions(-)


diff --git a/Modules/_tkinter.c b/Modules/_tkinter.c
--- a/Modules/_tkinter.c
+++ b/Modules/_tkinter.c
@@ -336,8 +336,7 @@
     PyObject *v;
 
     if (list == NULL) {
-        Py_INCREF(Py_None);
-        return Py_None;
+        Py_RETURN_NONE;
     }
 
     if (Tcl_SplitList((Tcl_Interp *)NULL, list, &argc, &argv) != TCL_OK) {
@@ -1308,8 +1307,7 @@
     Tcl_AddErrorInfo(Tkapp_Interp(self), msg);
     LEAVE_TCL
 
-    Py_INCREF(Py_None);
-    return Py_None;
+    Py_RETURN_NONE;
 }
 
 
@@ -1976,8 +1974,7 @@
         return NULL;
     }
 
-    Py_INCREF(Py_None);
-    return Py_None;
+    Py_RETURN_NONE;
 }
 
 
@@ -2018,8 +2015,7 @@
         PyErr_SetString(Tkinter_TclError, "can't delete Tcl command");
         return NULL;
     }
-    Py_INCREF(Py_None);
-    return Py_None;
+    Py_RETURN_NONE;
 }
 
 
@@ -2123,8 +2119,7 @@
     ENTER_TCL
     Tcl_CreateFileHandler(tfile, mask, FileHandler, (ClientData) data);
     LEAVE_TCL
-    Py_INCREF(Py_None);
-    return Py_None;
+    Py_RETURN_NONE;
 }
 
 static PyObject *
@@ -2148,8 +2143,7 @@
     ENTER_TCL
     Tcl_DeleteFileHandler(tfile);
     LEAVE_TCL
-    Py_INCREF(Py_None);
-    return Py_None;
+    Py_RETURN_NONE;
 }
 #endif /* HAVE_CREATEFILEHANDLER */
 
@@ -2181,8 +2175,7 @@
         Py_DECREF(func);
         Py_DECREF(v); /* See Tktt_New() */
     }
-    Py_INCREF(Py_None);
-    return Py_None;
+    Py_RETURN_NONE;
 }
 
 static PyMethodDef Tktt_methods[] =
@@ -2382,8 +2375,7 @@
         excInCmd = valInCmd = trbInCmd = NULL;
         return NULL;
     }
-    Py_INCREF(Py_None);
-    return Py_None;
+    Py_RETURN_NONE;
 }
 
 static PyObject *
@@ -2409,8 +2401,7 @@
         return NULL;
 
     quitMainLoop = 1;
-    Py_INCREF(Py_None);
-    return Py_None;
+    Py_RETURN_NONE;
 }
 
 static PyObject *
@@ -2467,8 +2458,7 @@
             return NULL;
         }
     }
-    Py_INCREF(Py_None);
-    return Py_None;
+    Py_RETURN_NONE;
 }
 
 static PyObject *
@@ -2482,8 +2472,7 @@
         return PyBool_FromLong(((TkappObject*)self)->wantobjects);
     ((TkappObject*)self)->wantobjects = wantobjects;
 
-    Py_INCREF(Py_None);
-    return Py_None;
+    Py_RETURN_NONE;
 }
 
 static PyObject *
@@ -2492,8 +2481,7 @@
 
     ((TkappObject*)self)->dispatching = 1;
 
-    Py_INCREF(Py_None);
-    return Py_None;
+    Py_RETURN_NONE;
 }
 
 
@@ -2738,8 +2726,7 @@
         return NULL;
     }
     Tkinter_busywaitinterval = new_val;
-    Py_INCREF(Py_None);
-    return Py_None;
+    Py_RETURN_NONE;
 }
 
 static char setbusywaitinterval_doc[] =

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list