- uvloop version: 0.16.0
- Python version: 3.9.6
- Platform: macOS 11.5.2
- Can you reproduce the bug with
PYTHONASYNCIODEBUG in env?: yes - Does uvloop behave differently from vanilla asyncio? How?: create_subprocess_exec treats
env differently.
When I set env={}, uvloop treats this as None and inherits all environment variables, while vanilla asyncio treats {} as an empty environment.
importasyncioimportosimportpytestifos.environ.get("UVLOOP"):
# Install uvloop event loop.importuvloop@pytest.fixturedefevent_loop():
loop=uvloop.new_event_loop()
yieldlooploop.close()
@pytest.mark.asyncioasyncdeftest_env():
"This test passes under vanilla asyncio but fails under uvloop."proc=awaitasyncio.create_subprocess_exec(
"/usr/bin/env",
stdout=asyncio.subprocess.PIPE,
env={},
)
result=awaitproc.communicate()
# Under uvloop, stdout contains the full, inherited environment.assertresult== (b"", None)
PYTHONASYNCIODEBUGin env?: yesenvdifferently.When I set env={}, uvloop treats this as None and inherits all environment variables, while vanilla asyncio treats {} as an empty environment.