[IPython-dev] Macros don't work in threaded shells
Ville M. Vainio
Mon Mar 10 13:53:08 CDT 2008
It appears recursive execution of _ip.runlines() is not possible with
threaded shells (and so e.g. macros hang ipython) - noticed this
through ticket #238, which is now a blocker.
This will hang IPython.
First, we come to MTInteractiveShell.runsource(""" _ip.runlines('1')""")
This is given to runcode, which then does runsource( "1"). This never
gets to runcode, because the thread is waiting for _ip.runlines('1')
According to this comment, it seems this scenario has been considered,
but the logic does not seem to work:
# Case 3
# Store code in queue, so the execution thread can handle it.
# Note that with macros and other applications, we MAY re-enter this
# section, so we have to acquire the lock with non-blocking semantics,
# else we deadlock.
got_lock = self.thread_ready.acquire()
self.thread_ready.wait() # Wait until processed in timeout interval
(and no, using got_lock = self.thread_ready.acquire(blocking=False)
won't fix it).
Fernando? You remember whether this used to work?
Ville M. Vainio - vivainio.googlepages.com
blog=360.yahoo.com/villevainio - g[mail | talk]='vivainio'
More information about the IPython-dev