mirror of
https://github.com/python/cpython.git
synced 2025-08-03 08:34:29 +00:00
Issue #4237: io.FileIO() was raising invalid warnings caused by insufficient initialization of PyFileIOObject struct members.
This commit is contained in:
parent
fec925b315
commit
df32b3967c
2 changed files with 11 additions and 2 deletions
|
@ -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++) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue