8000 GH-104510: Fix refleaks in _io base types by kumaraditya303 · Pull Request #104516 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

GH-104510: Fix refleaks in _io base types #104516

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 16, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
visit instance dict
  • Loading branch information
kumaraditya303 committed May 15, 2023
commit 5ee23584f2d96beaae1e0f1591f0fdfba9cb7965
8 changes: 8 additions & 0 deletions Modules/_io/_iomodule.h
Original file line number Diff line number Diff line change
Expand Up @@ -195,3 +195,11 @@ extern PyObject *_PyIOBase_cannot_pickle(PyObject *self, PyObject *args);
#ifdef HAVE_WINDOWS_CONSOLE_IO
extern char _PyIO_get_console_type(PyObject *);
#endif


typedef struct {
PyObject_HEAD

PyObject *dict;
PyObject *weakreflist;
} iobase;
1 change: 1 addition & 0 deletions Modules/_io/bufferedio.c
Original file line number Diff line number Diff line change
Expand Up @@ -2428,6 +2428,7 @@ static int
bufferediobase_traverse(PyObject *self, visitproc visit, void *arg)
{
Py_VISIT(Py_TYPE(self));
Py_VISIT(((iobase *)self)->dict);
return 0;
}

Expand Down
7 changes: 1 addition & 6 deletions Modules/_io/iobase.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,6 @@ class _io._RawIOBase "PyObject *" "clinic_state()->PyRawIOBase_Type"
* IOBase class, an abstract class
*/

typedef struct {
PyObject_HEAD

PyObject *dict;
PyObject *weakreflist;
} iobase;

PyDoc_STRVAR(iobase_doc,
"The abstract base class for all I/O classes.\n"
Expand Down Expand Up @@ -1040,6 +1034,7 @@ static int
rawiobase_traverse(PyObject *self, visitproc visit, void *arg)
{
Py_VISIT(Py_TYPE(self));
Py_VISIT(((iobase *)self)->dict);
return 0;
}

Expand Down
1 change: 1 addition & 0 deletions Modules/_io/textio.c
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ static int
textiobase_traverse(PyObject *self, visitproc visit, void *arg)
{
Py_VISIT(Py_TYPE(self));
Py_VISIT(((iobase *)self)->dict);
return 0;
}

Expand Down
0