##// END OF EJS Templates
use CFRunLoop directly in `ipython kernel --pylab osx`...
use CFRunLoop directly in `ipython kernel --pylab osx` via matplotlib.backend_macosx.TimerMac, rather than Tk Fallback on Tk if matplotlib is < 1.1.0, which introduces the necessary Timer. This means that it still won't work on current EPD, which has X11-linked libtk and matplotlib 1.0.1, but at least it will display a warning explaining why. also remove caveat in docs that qtconsole doesn't work with native MacOSX, since it does on normal (non-EPD) installs. So this will work in more places, but still not in most common failure case (stock EPD) described in #640.

File last commit:

r4755:c14b594e
r4853:5942e2a1
Show More
nested_context.py
50 lines | 1.5 KiB | text/x-python | PythonLexer
"""Backwards compatibility - we use contextlib.nested to support Python 2.6,
but it's removed in Python 3.2."""
# TODO : Remove this once we drop support for Python 2.6, and use
# "with a, b:" instead.
import sys
from contextlib import contextmanager
@contextmanager
def nested(*managers):
"""Combine multiple context managers into a single nested context manager.
This function has been deprecated in favour of the multiple manager form
of the with statement.
The one advantage of this function over the multiple manager form of the
with statement is that argument unpacking allows it to be
used with a variable number of context managers as follows:
with nested(*managers):
do_something()
"""
exits = []
vars = []
exc = (None, None, None)
try:
for mgr in managers:
exit = mgr.__exit__
enter = mgr.__enter__
vars.append(enter())
exits.append(exit)
yield vars
except:
exc = sys.exc_info()
finally:
while exits:
exit = exits.pop()
try:
if exit(*exc):
exc = (None, None, None)
except:
exc = sys.exc_info()
if exc != (None, None, None):
# Don't rely on sys.exc_info() still containing
# the right information. Another exception may
# have been raised and caught by an exit method
raise exc[0], exc[1], exc[2]