Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7f59fd7

Browse files
committed
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.
1 parent 76935b9 commit 7f59fd7

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

Modules/_io/fileio.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,6 @@ fileio_init(PyObject *oself, PyObject *args, PyObject *kwds)
377377
#endif
378378
self->fd = open(name, flags, 0666);
379379
Py_END_ALLOW_THREADS
380-
fd_is_own = 1;
381380
} else {
382381
PyObject *fdobj = PyObject_CallFunction(
383382
opener, "Oi", nameobj, flags);
@@ -395,9 +394,9 @@ fileio_init(PyObject *oself, PyObject *args, PyObject *kwds)
395394
if (self->fd == -1) {
396395
goto error;
397396
}
398-
fd_is_own = 1;
399397
}
400398

399+
fd_is_own = 1;
401400
if (self->fd < 0) {
402401
#ifdef MS_WINDOWS
403402
if (widename != NULL)

0 commit comments

Comments
 (0)