uvloop icon indicating copy to clipboard operation
uvloop copied to clipboard

`python -X dev` doesn't activate debug mode for uvloop loop

Open Jackenmen opened this issue 1 year ago • 0 comments

  • uvloop version: 0.16.0
  • Python version: 3.10.4 (system Python)
  • Platform: Ubuntu 22.04
  • Can you reproduce the bug with PYTHONASYNCIODEBUG in env?: No because the issue is about activating the debug mode through -X dev :)
  • Does uvloop behave differently from vanilla asyncio? How?: Yes, loop.get_debug() returns False when running with python -X dev

Reproduction steps:

  1. Install pre-requisites:
python -m venv repro_env
. repro_env/bin/activate
python -m pip install uvloop==0.16.0
  1. Create repro.py file with contents:
import asyncio

import uvloop


async def main(loop_name: str) -> None:
    loop = asyncio.get_running_loop()
    print(f"{loop_name=} {loop.get_debug()=}")


asyncio.run(main("asyncio loop"))
uvloop.install()
asyncio.run(main("uvloop loop"))
  1. Run python -X dev repro.py
  2. See output:
loop_name='asyncio loop' loop.get_debug()=True
loop_name='uvloop loop' loop.get_debug()=False

For comparison:

  • python repro.py:
loop_name='asyncio loop' loop.get_debug()=False
loop_name='uvloop loop' loop.get_debug()=False
  • PYTHONASYNCIODEBUG=1 python repro.py
loop_name='asyncio loop' loop.get_debug()=True
loop_name='uvloop loop' loop.get_debug()=True

Jackenmen avatar Aug 06 '22 21:08 Jackenmen