[Python-ideas] Hooks into the IO system to intercept raw file reads/writes (original) (raw)

Victor Stinner victor.stinner at gmail.com
Mon Feb 23 11:44:59 CET 2015


2015-02-10 15:49 GMT+01:00 Paul Moore <p.f.moore at gmail.com>:

Which code samples? I tried to ensure that all code snippets in asyncio doc and all examples in Tulip repository call loop.close(). For example, in https://docs.python.org/dev/library/asyncio-dev.html#detect-exceptions-never-consumed the first example doesn't close the loop. Neither of the fixes given close the loop either.

Oh ok, I forgot two examples. It's now fixed: https://hg.python.org/cpython/rev/05bd5ec8365e

Tell me if you see more examples where I forgot to explicitly close the event loop.

Hmm, so if I write a server and hit Ctrl-C to exit it, what happens? That's how non-asyncio things like http.server typically let the user quit.

When possible, it's better to register a signal handler to ask to stop the event loop.

(Oh, I forgot this old thread about hooking I/O! You should start a new thread if you would like to talk about asyncio!)

Victor



More information about the Python-ideas mailing list