mirror of
https://github.com/python/cpython.git
synced 2025-10-09 16:34:44 +00:00
bpo-34638: Store a weak reference to stream reader to break strong references loop (GH-9201)
Store a weak reference to stream readerfor breaking strong references It breaks the strong reference loop between reader and protocol and allows to detect and close the socket if the stream is deleted (garbage collected)
This commit is contained in:
parent
aca819fb49
commit
a5d1eb8d8b
4 changed files with 160 additions and 10 deletions
|
@ -36,6 +36,11 @@ class SubprocessStreamProtocol(streams.FlowControlMixin,
|
|||
info.append(f'stderr={self.stderr!r}')
|
||||
return '<{}>'.format(' '.join(info))
|
||||
|
||||
def _untrack_reader(self):
|
||||
# StreamWriter.close() expects the protocol
|
||||
# to have this method defined.
|
||||
pass
|
||||
|
||||
def connection_made(self, transport):
|
||||
self._transport = transport
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue