Beispiel #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)
Beispiel #2
0
def _greenlet_start(greenlet, args):
    _tls.current = greenlet
    try:
        res = greenlet.run(*args)
    finally:
        _continuation.permute(greenlet, greenlet.parent)
    return (res,)
Beispiel #3
0
def _greenlet_start(greenlet, args):
    _tls.current = greenlet
    try:
        res = greenlet.run(*args)
    finally:
        _continuation.permute(greenlet, greenlet.parent)
    return (res, )
Beispiel #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)
Beispiel #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)
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)
Beispiel #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)
Beispiel #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)
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)
Beispiel #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)
Beispiel #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)
Beispiel #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)
Beispiel #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)
Beispiel #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)
Beispiel #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)
Beispiel #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
Beispiel #17
0
def _greenlet_throw(greenlet, exc, value, tb):
    _tls.current = greenlet
    try:
        raise exc, value, tb
    finally:
        _continuation.permute(greenlet, greenlet.parent)
Beispiel #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))
Beispiel #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"
Beispiel #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"
Beispiel #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"
Beispiel #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))
Beispiel #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)