class W_UserCoState(Wrappable): def __init__(self, space): self.costate = AppCoState(space) self.costate.post_install() def descr_method__new__(space, w_subtype): costate = space.allocate_instance(W_UserCoState, w_subtype) W_UserCoState.__init__(costate, space) return space.wrap(costate) def w_getcurrent(self): space = self.costate.space return space.wrap(self.costate.current) def w_spawn(self, w_subtype=None): space = self.costate.space if space.is_w(w_subtype, space.w_None): w_subtype = space.gettypeobject(AppCoroutine.typedef) co = space.allocate_instance(AppCoroutine, w_subtype) AppCoroutine.__init__(co, space, state=self.costate) return space.wrap(co)
def __init__(self, space): self.costate = AppCoState(space) self.costate.post_install()