[issue4237] io.FileIO('foo', 'rt') prints a RuntimeWarning

Christian Heimes report at bugs.python.org
Thu Oct 30 02:18:52 CET 2008


Christian Heimes <lists at cheimes.de> added the comment:

I propose to move self->closefd closer to the top of the function:

Index: Modules/_fileio.c
===================================================================
--- Modules/_fileio.c   (Revision 67040)
+++ Modules/_fileio.c   (Arbeitskopie)
@@ -181,6 +181,7 @@

        self->readable = self->writable = 0;
        self->seekable = -1;
+       self->closefd = closefd;
        s = mode;
        while (*s) {
                switch (*s++) {
@@ -243,7 +244,6 @@

        if (fd >= 0) {
                self->fd = fd;
-               self->closefd = closefd;
        }
        else {
                self->closefd = 1;

----------
keywords: +needs review, patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue4237>
_______________________________________


More information about the Python-bugs-list mailing list