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