Fixed wrong warning about pending I/O in Task destructor

This commit is contained in:
Nocturn9x 2023-05-12 09:14:00 +02:00
parent 727848ada8
commit 33feb442e4
Signed by: nocturn9x
GPG Key ID: 8270F9F467971E59
2 changed files with 2 additions and 3 deletions

View File

@ -99,7 +99,6 @@ class AsyncStream:
await io_release(self.stream)
self.stream.close()
self.stream = None
await aiosched.checkpoint()
async def fileno(self):
"""

View File

@ -142,5 +142,5 @@ class Task:
if not self.done():
warnings.warn(f"task '{self.name}' was destroyed, but it has not completed yet")
if self.last_io:
warnings.warn(f"task '{self.name}' was destroyed, but it has pending I/O")
if self.last_io and self.last_io[1].fileno() != -1:
warnings.warn(f"task '{self.name}' was destroyed, but it has pending I/O: forgot to close a resource?")