Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Avoid setting event loop policy if within IPython kernel and no runni…
…ng event loop (#3336) Setting asyncio event loop policy at these two places could cause problems. 1. When policy is set in Jupyter notebook server extension. This causes the notebook server to hang. This is fixed in #2343. 2. When policy is set in iPython startup config (`~/.ipython/profile_default/startup/whatever.py`) or by setting `get_config().InteractiveShellApp.exec_lines` in `~/.ipython/profile_default/ipython_config.py`. This causes the kernel to hang. This can be reproduced by running either `jupyter console` or `jupyter notebook`. If running In Jupyter notebook, it will struck at "Kernel starting, please wait...". Note that manually setting the policy in notebook cell, after the kernel has started, is fine. In both cases, running `asyncio.get_running_loop()` just before setting the policy will raise `RuntimeError`, meaning there is no running event loop yet. See #3202.
- Loading branch information