[Python-checkins] cpython: Simplify code in fileio_init

hynek.schlawack python-checkins at python.org
Fri Jun 22 09:34:05 CEST 2012


http://hg.python.org/cpython/rev/701d4989504d
changeset:   77563:701d4989504d
parent:      77561:9f88c38318ac
user:        Hynek Schlawack <hs at ox.cx>
date:        Fri Jun 22 09:32:22 2012 +0200
summary:
  Simplify code in fileio_init

If an identical code line is in both at the end of if and else, it can as well
stand after the block. :) The code is from 464cf523485e, I didn't see it before
checking the commits in the web interface of course.

files:
  Modules/_io/fileio.c |  3 +--
  1 files changed, 1 insertions(+), 2 deletions(-)


diff --git a/Modules/_io/fileio.c b/Modules/_io/fileio.c
--- a/Modules/_io/fileio.c
+++ b/Modules/_io/fileio.c
@@ -377,7 +377,6 @@
 #endif
                 self->fd = open(name, flags, 0666);
             Py_END_ALLOW_THREADS
-            fd_is_own = 1;
         } else {
             PyObject *fdobj = PyObject_CallFunction(
                                   opener, "Oi", nameobj, flags);
@@ -395,9 +394,9 @@
             if (self->fd == -1) {
                 goto error;
             }
-            fd_is_own = 1;
         }
 
+        fd_is_own = 1;
         if (self->fd < 0) {
 #ifdef MS_WINDOWS
             if (widename != NULL)

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


More information about the Python-checkins mailing list