dabeaz / curio

Good Curio!
Other
4.04k stars 244 forks source link

curio.run(coro, shutdown=True) #297

Closed nikhilro closed 5 years ago

nikhilro commented 5 years ago

Hey David (@dabeaz), we would sometimes get this RuntimeError when something deep in one of our tasks went awry. It was resolved by using curio.Kernel(...).run(coro, ..., shutdown=True). curio.run should expose that control since it seems natural to be unaware of the Kernel and mostly only rely on the helper function. Thanks!

dabeaz commented 5 years ago

The global run() function executes code using the kernel as a context manager. The context manager already executes Kernel.run(shutdown=True). Adding a shutdown option to run() would be redundant. Perhaps I'm missing something.

nikhilro commented 5 years ago

Ahh yes, you're right. I checked my local version and turns out I was using v0.9 from pip with this as __exit__ which was wrongly intercepting exceptions. Simply changing those two lines in __exit__ with the now correct version properly shuts down. Apologies, for my laziness in just quickly glancing over the codebase. Will close this now. Thanks