mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
[3.11] [3.12] GH-106684: Close asyncio.StreamWriter
when asyncio.StreamWriter
is not closed by application (GH-107650) (GH-107656) (#107836)
[3.12] GH-106684: Close `asyncio.StreamWriter` when `asyncio.StreamWriter` is not closed by application (GH-107650) (GH-107656) GH-106684: raise `ResourceWarning` when `asyncio.StreamWriter` is not closed (GH-107650) (cherry picked from commit41178e4199
) (cherry picked from commit7853c76906
) Co-authored-by: Kumar Aditya <kumaraditya@python.org>
This commit is contained in:
parent
eff2042fac
commit
fb08b7905e
2 changed files with 5 additions and 0 deletions
|
@ -391,6 +391,10 @@ class StreamWriter:
|
|||
self._transport = new_transport
|
||||
protocol._replace_writer(self)
|
||||
|
||||
def __del__(self):
|
||||
if not self._transport.is_closing():
|
||||
self.close()
|
||||
|
||||
|
||||
class StreamReader:
|
||||
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
Close :class:`asyncio.StreamWriter` when it is not closed by application leading to memory leaks. Patch by Kumar Aditya.
|
Loading…
Add table
Add a link
Reference in a new issue