mirror of
https://github.com/python/cpython.git
synced 2025-08-08 19:09:46 +00:00
[3.12] GH-106684: Close asyncio.StreamWriter
when asyncio.StreamWriter
is not closed by application (GH-107650) (#107656)
GH-106684: raise `ResourceWarning` when `asyncio.StreamWriter` is not closed (GH-107650)
(cherry picked from commit 41178e4199
)
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
This commit is contained in:
parent
a71500cd24
commit
7853c76906
2 changed files with 5 additions and 0 deletions
|
@ -392,6 +392,10 @@ class StreamWriter:
|
|||
self._transport = new_transport
|
||||
protocol._replace_writer(self)
|
||||
|
||||
def __del__(self):
|
||||
if not self._transport.is_closing():
|
||||
self.close()
|
||||
|
||||
|
||||
class StreamReader:
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue