[Python-checkins] cpython: Adjust None handling to be a bit more clean. Thanks to Benjamin

brian.curtin python-checkins at python.org
Mon Nov 7 21:20:09 CET 2011


http://hg.python.org/cpython/rev/d0a73bd3162c
changeset:   73436:d0a73bd3162c
parent:      73420:fb73fe5d0ab1
user:        Brian Curtin <brian at python.org>
date:        Mon Nov 07 10:51:18 2011 -0600
summary:
  Adjust None handling to be a bit more clean. Thanks to Benjamin
for pointing it out.

files:
  Modules/posixmodule.c |  8 ++++----
  1 files changed, 4 insertions(+), 4 deletions(-)


diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -3543,7 +3543,7 @@
 posix_utime(PyObject *self, PyObject *args)
 {
 #ifdef MS_WINDOWS
-    PyObject *arg = NULL;
+    PyObject *arg = Py_None;
     PyObject *obwpath;
     wchar_t *wpath = NULL;
     PyObject *oapath;
@@ -3589,7 +3589,7 @@
         Py_DECREF(oapath);
     }
 
-    if (!arg || (arg == Py_None)) {
+    if (arg == Py_None) {
         SYSTEMTIME now;
         GetSystemTime(&now);
         if (!SystemTimeToFileTime(&now, &mtime) ||
@@ -3633,13 +3633,13 @@
     time_t atime, mtime;
     long ausec, musec;
     int res;
-    PyObject* arg = NULL;
+    PyObject* arg = Py_None;
 
     if (!PyArg_ParseTuple(args, "O&|O:utime",
                           PyUnicode_FSConverter, &opath, &arg))
         return NULL;
     path = PyBytes_AsString(opath);
-    if (!arg || (arg == Py_None)) {
+    if (arg == Py_None) {
         /* optional time values not given */
         Py_BEGIN_ALLOW_THREADS
         res = utime(path, NULL);

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


More information about the Python-checkins mailing list