[Python-ideas] Flagging blocking functions not to be used with asyncio
Guido van Rossum
guido at python.org
Fri Oct 7 13:34:25 EDT 2016
On Fri, Oct 7, 2016 at 9:52 AM, Yury Selivanov <yselivanov.ml at gmail.com> wrote:
> On 2016-10-07 11:16 AM, Guido van Rossum wrote:
>
>> Maybe a simpler approach would be to write a linter that checks for a
>> known list of common blocking functions, and anything that calls those
>> automatically gets the same property?
>
> What if somebody uses logging module and logs to a file? I think this is
> something that linters can't infer (how logging is configured).
And depending on your use case this may be acceptable.
> One way to solve this would be to monkeypatch the io and os modules (gevent
> does that, so it's possible) to issue a warning when it's used in an asyncio
> context. This can be done as a module on PyPI.
>
> Another way would be to add some kind of IO tracing hooks to CPython.
Honestly before writing a lot of code here I'd like to hear more from
Martin about the spread of mistakes he's observed among his users.
--
--Guido van Rossum (python.org/~guido)
More information about the Python-ideas
mailing list