##// END OF EJS Templates
Make event triggering robust to (un)registration....
Make event triggering robust to (un)registration. Event callbacks can register or unregister new callbacks for the same event while executing, and the previous triggering implementation allowed for event callbacks to be inadvertently skipped. The fix is to make a copy of the list of callbacks before executing any of them. With this change, the resulting semantics are simple: any callbacks registered before triggering are executed, and any new callbacks registered are only visible at the next triggering of the event. Note that this could potentially break existing callers who expected newly-appended callbacks were immediately executed. Fixes #9447. Originally based on a patch by @marksandler2.

File last commit:

r21515:2c9013e4
r22317:68860ee5
Show More
__init__.py
35 lines | 1.1 KiB | text/x-python | PythonLexer
"""
Shim to maintain backwards compatibility with old IPython.kernel imports.
"""
# Copyright (c) IPython Development Team.
# Distributed under the terms of the Modified BSD License.
import sys
from warnings import warn
from IPython.utils.shimmodule import ShimModule, ShimWarning
warn("The `IPython.kernel` package has been deprecated. "
"You should import from ipykernel or jupyter_client instead.", ShimWarning)
# zmq subdir is gone
sys.modules['IPython.kernel.zmq.session'] = ShimModule(
src='IPython.kernel.zmq.session', mirror='jupyter_client.session')
sys.modules['IPython.kernel.zmq'] = ShimModule(
src='IPython.kernel.zmq', mirror='ipykernel')
for pkg in ('comm', 'inprocess'):
src = 'IPython.kernel.%s' % pkg
sys.modules[src] = ShimModule(src=src, mirror='ipykernel.%s' % pkg)
for pkg in ('ioloop', 'blocking'):
src = 'IPython.kernel.%s' % pkg
sys.modules[src] = ShimModule(src=src, mirror='jupyter_client.%s' % pkg)
# required for `from IPython.kernel import PKG`
from ipykernel import comm, inprocess
from jupyter_client import ioloop, blocking
# public API
from ipykernel.connect import *
from jupyter_client import *