Summary
Hello,
with the recent updates ruff started to complain on following snippet of code:
import asyncio
async def main() -> None:
input("sync")
await asyncio.to_thread(lambda: input("async"))
if __name__ == '__main__':
asyncio.run(main())
$ ruff check --select=ASYNC250 async.py
ASYNC250 Blocking call to `input()` in async context
--> async.py:6:5
|
5 | async def main() -> None:
6 | input("sync")
| ^^^^^
7 | await asyncio.to_thread(lambda: input("async"))
|
ASYNC250 Blocking call to `input()` in async context
--> async.py:7:37
|
5 | async def main() -> None:
6 | input("sync")
7 | await asyncio.to_thread(lambda: input("async"))
| ^^^^^
|
Found 2 errors.
for comparison flake8-async passes "async" invocation:
$ flake8 --enable=ASYNC250 async.py
async.py:6:5: ASYNC250 Blocking sync call `input()` in async function. Wrap in `asyncio.loop.run_in_executor`.
Version
ruff 0.15.1
Summary
Hello,
with the recent updates ruff started to complain on following snippet of code:
for comparison flake8-async passes "async" invocation:
Version
ruff 0.15.1