Exemplo n.º 1
0
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)
Exemplo n.º 2
0
def _greenlet_start(greenlet, args):
    _tls.current = greenlet
    try:
        res = greenlet.run(*args)
    finally:
        _continuation.permute(greenlet, greenlet.parent)
    return (res,)
Exemplo n.º 3
0
def _greenlet_start(greenlet, args):
    _tls.current = greenlet
    try:
        res = greenlet.run(*args)
    finally:
        _continuation.permute(greenlet, greenlet.parent)
    return (res, )
Exemplo n.º 4
0
 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)
Exemplo n.º 5
0
 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)
Exemplo n.º 6
0
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)
Exemplo n.º 7
0
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)
Exemplo n.º 8
0
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)
Exemplo n.º 9
0
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)
Exemplo n.º 10
0
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)
Exemplo n.º 11
0
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)
Exemplo n.º 12
0
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)
Exemplo n.º 13
0
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)
Exemplo n.º 14
0
 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)
Exemplo n.º 15
0
 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)
Exemplo n.º 16
0
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
Exemplo n.º 17
0
def _greenlet_throw(greenlet, exc, value, tb):
    _tls.current = greenlet
    try:
        raise exc, value, tb
    finally:
        _continuation.permute(greenlet, greenlet.parent)
Exemplo n.º 18
0
 def test_permute_noninitialized(self):
     from _continuation import continulet, permute
     permute(continulet.__new__(continulet))    # ignored
     permute(continulet.__new__(continulet),    # ignored
             continulet.__new__(continulet))
Exemplo n.º 19
0
 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"
Exemplo n.º 20
0
 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"
Exemplo n.º 21
0
 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"
Exemplo n.º 22
0
 def test_permute_noninitialized(self):
     from _continuation import continulet, permute
     permute(continulet.__new__(continulet))  # ignored
     permute(
         continulet.__new__(continulet),  # ignored
         continulet.__new__(continulet))
Exemplo n.º 23
0
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)