New submission from Ron Frederick <r...@timeheart.net>:
In testing AsyncSSH against Python 3.8, I noticed a large number of the following errors, even though I was properly closing streams before the objects holding them were garbage-collected. An open stream object is being garbage collected; call "stream.close()" explicitly. After some investigation, the problem appears to be that closing a stream is not good enough to prevent the error. The check in asyncio doesn't properly handle the case where the stream is closing, but has not fully closed. Here's a simple test program that demonstrates this: import asyncio async def tcp_client(): reader, writer = await asyncio.open_connection('127.0.0.1', 22) writer.close() asyncio.run(tcp_client()) It's possible to avoid this message by awaiting on writer.wait_closed(), but wait_closed() doesn't exist until Python 3.7, making it very difficult to write portable code and still avoid this message. ---------- components: asyncio messages: 354953 nosy: Ron Frederick, asvetlov, yselivanov priority: normal severity: normal status: open title: Python 3.8 improperly warns about closing properly closed streams type: behavior versions: Python 3.8 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue38529> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com