Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 91ce3ac

Browse filesBrowse files
[3.12] pythonGH-106684: Close asyncio.StreamWriter when asyncio.StreamWriter is not closed by application (pythonGH-107650) (pythonGH-107656)
pythonGH-106684: raise `ResourceWarning` when `asyncio.StreamWriter` is not closed (pythonGH-107650) (cherry picked from commit 41178e4) (cherry picked from commit 7853c76) Co-authored-by: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Co-authored-by: Kumar Aditya <kumaraditya@python.org> Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
1 parent eff2042 commit 91ce3ac
Copy full SHA for 91ce3ac

File tree

2 files changed

+5
-0
lines changed
Filter options

2 files changed

+5
-0
lines changed

‎Lib/asyncio/streams.py

Copy file name to clipboardExpand all lines: Lib/asyncio/streams.py
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,10 @@ async def start_tls(self, sslcontext, *,
391391
self._transport = new_transport
392392
protocol._replace_writer(self)
393393

394+
def __del__(self):
395+
if not self._transport.is_closing():
396+
self.close()
397+
394398

395399
class StreamReader:
396400

+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Close :class:`asyncio.StreamWriter` when it is not closed by application leading to memory leaks. Patch by Kumar Aditya.

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.