Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
629eb689
Commit
629eb689
authored
Sep 30, 2014
by
Georg Brandl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #22517: When a io.BufferedRWPair object is deallocated, clear its
weakrefs.
parent
2431198b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
0 deletions
+11
-0
Lib/test/test_io.py
Lib/test/test_io.py
+6
-0
Misc/NEWS
Misc/NEWS
+3
-0
Modules/_io/bufferedio.c
Modules/_io/bufferedio.c
+2
-0
No files found.
Lib/test/test_io.py
View file @
629eb689
...
...
@@ -1454,6 +1454,12 @@ class BufferedRWPairTest(unittest.TestCase):
pair
=
self
.
tp
(
SelectableIsAtty
(
True
),
SelectableIsAtty
(
True
))
self
.
assertTrue
(
pair
.
isatty
())
def
test_weakref_clearing
(
self
):
brw
=
self
.
tp
(
self
.
MockRawIO
(),
self
.
MockRawIO
())
ref
=
weakref
.
ref
(
brw
)
brw
=
None
ref
=
None
# Shouldn't segfault.
class
CBufferedRWPairTest
(
BufferedRWPairTest
):
tp
=
io
.
BufferedRWPair
...
...
Misc/NEWS
View file @
629eb689
...
...
@@ -10,6 +10,9 @@ What's New in Python 3.2.6?
Library
-------
- Issue #22517: When a io.BufferedRWPair object is deallocated, clear its
weakrefs.
- Issue #16041: CVE-2013-1752: poplib: Limit maximum line lengths to 2048 to
prevent readline() calls from consuming too much memory. Patch by Jyrki
Pulliainen.
...
...
Modules/_io/bufferedio.c
View file @
629eb689
...
...
@@ -2141,6 +2141,8 @@ static void
bufferedrwpair_dealloc
(
rwpair
*
self
)
{
_PyObject_GC_UNTRACK
(
self
);
if
(
self
->
weakreflist
!=
NULL
)
PyObject_ClearWeakRefs
((
PyObject
*
)
self
);
Py_CLEAR
(
self
->
reader
);
Py_CLEAR
(
self
->
writer
);
Py_CLEAR
(
self
->
dict
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment