def _greenlet_throw(greenlet, exc, value, tb): _tls.current = greenlet try: raise exc, value, tb finally: if greenlet.parent is not _tls.main: _continuation.permute(greenlet, greenlet.parent)
def _greenlet_start(greenlet, args): _tls.current = greenlet try: res = greenlet.run(*args) finally: _continuation.permute(greenlet, greenlet.parent) return (res,)
def _greenlet_start(greenlet, args): _tls.current = greenlet try: res = greenlet.run(*args) finally: _continuation.permute(greenlet, greenlet.parent) return (res, )
def _run(c): _tls.current_fiber = self try: return target(*args, **kwargs) finally: cont = self._cont self._cont = None self._ended = True _continuation.permute(cont, self._get_active_parent()._cont)
def _greenlet_throw(greenlet, exc, value, tb): _tls.current = greenlet try: raise __pypy__.normalize_exc(exc, value, tb) except GreenletExit as e: res = e finally: _continuation.permute(greenlet, greenlet.parent) return ((res,), None)
def _greenlet_throw(greenlet, exc, value, tb): _tls.current = greenlet try: raise __pypy__.normalize_exc(exc, value, tb) except GreenletExit as e: res = e finally: _continuation.permute(greenlet, greenlet.parent) return ((res, ), None)
def _greenlet_start(greenlet, args): args, kwds = args _tls.current = greenlet try: res = greenlet.run(*args, **kwds) except GreenletExit as e: res = e finally: _continuation.permute(greenlet, greenlet.parent) return ((res, ), None)
def _greenlet_start(greenlet, args): args, kwds = args _tls.current = greenlet try: res = greenlet.run(*args, **kwds) except GreenletExit as e: res = e finally: _continuation.permute(greenlet, greenlet.parent) return ((res,), None)
def _greenlet_throw(greenlet, exc, value, tb): try: _tls.current = greenlet try: if hasattr(_tls, 'trace'): _run_trace_callback('throw') raise exc, value, tb except GreenletExit, e: res = e finally: _continuation.permute(greenlet, greenlet.parent) return ((res, ), None)
def _greenlet_throw(greenlet, exc, value, tb): try: _tls.current = greenlet try: if hasattr(_tls, 'trace'): _run_trace_callback('throw') raise exc, value, tb except GreenletExit, e: res = e finally: _continuation.permute(greenlet, greenlet.parent) return ((res,), None)
def _greenlet_start(greenlet, args): try: args, kwds = args _tls.current = greenlet try: if hasattr(_tls, 'trace'): _run_trace_callback('switch') res = greenlet.run(*args, **kwds) except GreenletExit, e: res = e finally: _continuation.permute(greenlet, greenlet.parent) return ((res, ), None)
def _greenlet_start(greenlet, args): try: args, kwds = args _tls.current = greenlet try: if hasattr(_tls, 'trace'): _run_trace_callback('switch') res = greenlet.run(*args, **kwds) except GreenletExit, e: res = e finally: _continuation.permute(greenlet, greenlet.parent) return ((res,), None)
def _run(c): _tls.current_fiber = self try: return target(*args, **kwargs) finally: cont = self._cont self._cont = None self._ended = True parent = self.parent while True: if parent is not None and parent._cont is not None and not parent._ended: break parent = parent.parent _continuation.permute(cont, parent._cont)
def _greenlet_throw(greenlet, exc, value, tb): try: _tls.current = greenlet try: if hasattr(_tls, 'trace'): _run_trace_callback('throw') raise __pypy__.normalize_exc(exc, value, tb) except GreenletExit as e: res = e finally: _continuation.permute(greenlet, greenlet.parent) return ((res,), None) finally: _tls.leaving = greenlet
def _greenlet_throw(greenlet, exc, value, tb): _tls.current = greenlet try: raise exc, value, tb finally: _continuation.permute(greenlet, greenlet.parent)
def test_permute_noninitialized(self): from _continuation import continulet, permute permute(continulet.__new__(continulet)) # ignored permute(continulet.__new__(continulet), # ignored continulet.__new__(continulet))
def f2(c2): assert sys._getframe(1).f_code.co_name == 'main' permute(c1, c2) assert sys._getframe(1).f_code.co_name == 'f1' return "ok"
def f2(c2): assert sys._getframe(1).f_code.co_name == "main" permute(c1, c2) assert sys._getframe(1).f_code.co_name == "f1" return "ok"
def test_permute_noninitialized(self): from _continuation import continulet, permute permute(continulet.__new__(continulet)) # ignored permute( continulet.__new__(continulet), # ignored continulet.__new__(continulet))
def _green_create_main(): # create the main greenlet for this thread _tls.current = None gmain = greenlet.__new__(greenlet) gmain._greenlet__main = True gmain._greenlet__started = True assert gmain.parent is None _tls.main = gmain _tls.current = gmain def _greenlet_start(greenlet, args): args, kwds = args _tls.current = greenlet try: res = greenlet.run(*args, **kwds) except GreenletExit, e: res = e finally: _continuation.permute(greenlet, greenlet.parent) return ((res,), None) def _greenlet_throw(greenlet, exc, value, tb): _tls.current = greenlet try: raise exc, value, tb except GreenletExit, e: res = e finally: _continuation.permute(greenlet, greenlet.parent) return ((res,), None)