def __init__(self, space, state=None): self.space = space if state is None: state = AppCoroutine._get_state(space) Coroutine.__init__(self, state) self.flags = 0 self.newsubctx()
def __init__(self, space, w_callable=None, is_main=False): Coroutine.__init__(self, self._get_state(space)) self.space = space self.w_callable = w_callable self.active = is_main self.subctx = space.getexecutioncontext().Subcontext() if is_main: self.subctx.clear_framestack() # wack else: self.bind(GreenletThunk(self))
def switch(self): space = self.space try: Coroutine.switch(self) except CoroutineExit: raise OperationError(self.costate.w_CoroutineExit, space.w_None)