summaryrefslogtreecommitdiffstats
path: root/Lib/asyncio/streams.py
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2023-08-10 10:44:31 (GMT)
committerGitHub <noreply@github.com>2023-08-10 10:44:31 (GMT)
commitfb08b7905eaf67902a89eeec0f8c1aa5ee0c7ea5 (patch)
tree8d62b40f10d66b9af1954ea7e6d0908f9b420911 /Lib/asyncio/streams.py
parenteff2042fac6dc7d6e2f8aeec5a64a3a44a1a9648 (diff)
downloadcpython-fb08b7905eaf67902a89eeec0f8c1aa5ee0c7ea5.zip
cpython-fb08b7905eaf67902a89eeec0f8c1aa5ee0c7ea5.tar.gz
cpython-fb08b7905eaf67902a89eeec0f8c1aa5ee0c7ea5.tar.bz2
[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 commit 41178e41995992bbe417f94bce158de93f9e3188) (cherry picked from commit 7853c769067699c79c0d4fe4967e9d8f8b8b0a5e) Co-authored-by: Kumar Aditya <kumaraditya@python.org>
Diffstat (limited to 'Lib/asyncio/streams.py')
-rw-r--r--Lib/asyncio/streams.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/Lib/asyncio/streams.py b/Lib/asyncio/streams.py
index 560ad8a..3d577f1 100644
--- a/Lib/asyncio/streams.py
+++ b/Lib/asyncio/streams.py
@@ -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: