GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||
GeezerVison is showing github.com — [3.12] GH-106684: Close `asyncio.StreamWriter` when `asyncio.StreamWriter` is not closed by application (GH-107650) by miss-islington · Pull Request #107656 · python/cpython Conversation
|
|
I think this should go into rc2, but without the warning. I think the warning is too potentially disruptive this late in the release cycle. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
a16f262 to
02429ce
Compare
ResourceWarning when asyncio.StreamWriter is not closed (GH-107650)asyncio.StreamWriter when asyncio.StreamWriter is not closed by application (GH-107650)
|
Thanks @miss-islington for the PR, and @Yhg1s for merging it 🌮🎉.. I'm working now to backport this PR to: 3.11. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
GH-107836 is a backport of this pull request to the 3.11 branch. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
…reamWriter` 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) <[email protected]> Co-authored-by: Kumar Aditya <[email protected]> Co-authored-by: Kumar Aditya <[email protected]>
…treamWriter` 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 41178e4) (cherry picked from commit 7853c76) Co-authored-by: Kumar Aditya <[email protected]>
|
It seems that closing the connection in the StreamWriter's import asyncio HOST = 'ifconfig.me' PORT = 80 async def connect() -> asyncio.Transport: reader, writer = await asyncio.open_connection( host=HOST, port=PORT, ) return writer.transport async def fetch(): loop = asyncio.get_running_loop() transport = await connect() # !!! transport is already closed here after this PR merged reader = asyncio.StreamReader(limit=2**16, loop=loop) protocol = asyncio.StreamReaderProtocol(reader, loop=loop) transport.set_protocol(protocol) loop.call_soon(protocol.connection_made, transport) loop.call_soon(transport.resume_reading) writer = asyncio.StreamWriter( transport=transport, protocol=protocol, reader=reader, loop=loop, ) request = f'GET /ip HTTP/1.1\r\nHost: {HOST}\r\nConnection: close\r\n\r\n'.encode() writer.write(request) await writer.drain() response = await reader.read(-1) print(response) if __name__ == '__main__': asyncio.run(fetch()) |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.