-
Notifications
You must be signed in to change notification settings - Fork 20
Closed
Labels
Programmers WantedAdditional Programmers wanted for writing a fix or helping with the review process.Additional Programmers wanted for writing a fix or helping with the review process.bugSomething isn't workingSomething isn't workinghelp wantedExtra attention is neededExtra attention is needed
Description
Hi! On Winloop, but not on stdlib's default event loop or on uvloop, Process.stdin.write + Process.stdin.drain is succeeding after the pipe is closed:
import asyncio
import subprocess
import sys
import winloop
async def main() -> None:
process = await asyncio.create_subprocess_exec(
sys.executable, "-c", "", stdin=subprocess.PIPE
)
assert process.stdin is not None
# Wait for the other end of the pipe to be closed:
await process.wait()
# Confirm that the IO manager knows that the pipe was closed:
assert process.stdin.is_closing()
# Therefore one of these should raise:
process.stdin.write(b"foo") # raises on uvloop
await process.stdin.drain() # raises on stdlib
# But neither raises on Winloop currently! However, on Winloop they will raise if
# called subsequently:
# await process.stdin.drain()
# asyncio.run(main())
asyncio.run(main(), loop_factory=winloop.new_event_loop)Winloop version: 0.3.0
Python version: CPython 3.13.7
The stdlib implementation has a conditional checkpoint in drain() which handles this case:
https://github.com/python/cpython/blob/v3.14.0/Lib/asyncio/streams.py#L375-L378
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Programmers WantedAdditional Programmers wanted for writing a fix or helping with the review process.Additional Programmers wanted for writing a fix or helping with the review process.bugSomething isn't workingSomething isn't workinghelp wantedExtra attention is neededExtra attention is needed