]> granicus.if.org Git - python/commitdiff
Simplify code in fileio_init
authorHynek Schlawack <hs@ox.cx>
Fri, 22 Jun 2012 07:32:22 +0000 (09:32 +0200)
committerHynek Schlawack <hs@ox.cx>
Fri, 22 Jun 2012 07:32:22 +0000 (09:32 +0200)
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.

Modules/_io/fileio.c

index 31e2994a0e49fa99c496e6414b3a75ef3fcc1379..226a5d275058cb210ad6e960f770eee7263e2ec8 100644 (file)
@@ -377,7 +377,6 @@ fileio_init(PyObject *oself, PyObject *args, PyObject *kwds)
 #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 @@ fileio_init(PyObject *oself, PyObject *args, PyObject *kwds)
             if (self->fd == -1) {
                 goto error;
             }
-            fd_is_own = 1;
         }
 
+        fd_is_own = 1;
         if (self->fd < 0) {
 #ifdef MS_WINDOWS
             if (widename != NULL)