'Starts or resumes the generator, running until it reaches a
yield point that is not ready.'

def run(self):

    if (self.running or self.finished):
        return
    try:
        self.running = True
        while True:
            future = self.future
            if (not future.done()):
                return
            self.future = None
            try:
                orig_stack_contexts = stack_context._state.contexts
                try:
                    value = future.result()
                except Exception:
                    self.had_exception = True
                    yielded = self.gen.throw(*sys.exc_info())
                else:
                    yielded = self.gen.send(value)
                if (stack_context._state.contexts is not orig_stack_contexts):
                    self.gen.throw(stack_context.StackContextInconsistentError('stack_context    inconsistency    (probably    caused    by    yield    within    a    "with    StackContext"    block)'))
            except (StopIteration, Return) as e:
                self.finished = True
                self.future = _null_future
                if (self.pending_callbacks and (not self.had_exception)):
                    raise LeakedCallbackError(('finished    without    waiting    for    callbacks    %r' % self.pending_callbacks))
                self.result_future.set_result(getattr(e, 'value', None))
                self.result_future = None
                self._deactivate_stack_context()
                return
            except Exception:
                self.finished = True
                self.future = _null_future
                self.result_future.set_exc_info(sys.exc_info())
                self.result_future = None
                self._deactivate_stack_context()
                return
            if (not self.handle_yield(yielded)):
                return
    finally:
        self.running = False
