Hi,

I just read a recent bugfix in asyncio:

https://github.com/python/cpython/commit/9602643120a509858d0bee4215d7f150e6125468

+ try:
+     await waiter
+ except Exception:
+     transport.close()
+     raise

Why only catching "except Exception:"? Why not also catching
KeyboardInterrupt or MemoryError? Is it a special rule for asyncio, or
a general policy in Python stdlib?

For me, it's fine to catch any exception using "except:" if the block
contains "raise", typical pattern to cleanup a resource in case of
error. Otherwise, there is a risk of leaking open file or not flushing
data on disk, for example.

Victor
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to