summaryrefslogtreecommitdiffstats
path: root/Modules/_fileio.c
diff options
context:
space:
mode:
authorChristian Heimes <christian@cheimes.de>2008-10-30 21:23:35 (GMT)
committerChristian Heimes <christian@cheimes.de>2008-10-30 21:23:35 (GMT)
commitdf32b3967c810fb54bb8fec966fec7ae009cf065 (patch)
tree18ed32fbf7f9d663d214b6de81c6519ece6ee018 /Modules/_fileio.c
parentfec925b315efbf8a6a15251b65910266f5e20c8a (diff)
downloadcpython-df32b3967c810fb54bb8fec966fec7ae009cf065.zip
cpython-df32b3967c810fb54bb8fec966fec7ae009cf065.tar.gz
cpython-df32b3967c810fb54bb8fec966fec7ae009cf065.tar.bz2
Issue #4237: io.FileIO() was raising invalid warnings caused by insufficient initialization of PyFileIOObject struct members.
Diffstat (limited to 'Modules/_fileio.c')
-rw-r--r--Modules/_fileio.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/Modules/_fileio.c b/Modules/_fileio.c
index 3b0f81b..4b35194 100644
--- a/Modules/_fileio.c
+++ b/Modules/_fileio.c
@@ -86,6 +86,10 @@ fileio_new(PyTypeObject *type, PyObject *args, PyObject *kews)
self = (PyFileIOObject *) type->tp_alloc(type, 0);
if (self != NULL) {
self->fd = -1;
+ self->readable = 0;
+ self->writable = 0;
+ self->seekable = -1;
+ self->closefd = 1;
self->weakreflist = NULL;
}
@@ -179,8 +183,6 @@ fileio_init(PyObject *oself, PyObject *args, PyObject *kwds)
}
}
- self->readable = self->writable = 0;
- self->seekable = -1;
s = mode;
while (*s) {
switch (*s++) {