MCPcopy Create free account
hub / github.com/EasyIME/PIME / run

Method run

python/python3/tornado/gen.py:750–802  ·  view source on GitHub ↗

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

(self)

Source from the content-addressed store, hash-verified

748 self.ctx_run(self.run)
749
750 def run(self) -> None:
751 """Starts or resumes the generator, running until it reaches a
752 yield point that is not ready.
753 """
754 if self.running or self.finished:
755 return
756 try:
757 self.running = True
758 while True:
759 future = self.future
760 if future is None:
761 raise Exception("No pending future")
762 if not future.done():
763 return
764 self.future = None
765 try:
766 exc_info = None
767
768 try:
769 value = future.result()
770 except Exception:
771 exc_info = sys.exc_info()
772 future = None
773
774 if exc_info is not None:
775 try:
776 yielded = self.gen.throw(*exc_info) # type: ignore
777 finally:
778 # Break up a reference to itself
779 # for faster GC on CPython.
780 exc_info = None
781 else:
782 yielded = self.gen.send(value)
783
784 except (StopIteration, Return) as e:
785 self.finished = True
786 self.future = _null_future
787 future_set_result_unless_cancelled(
788 self.result_future, _value_from_stopiteration(e)
789 )
790 self.result_future = None # type: ignore
791 return
792 except Exception:
793 self.finished = True
794 self.future = _null_future
795 future_set_exc_info(self.result_future, sys.exc_info())
796 self.result_future = None # type: ignore
797 return
798 if not self.handle_yield(yielded):
799 return
800 yielded = None
801 finally:
802 self.running = False
803
804 def handle_yield(self, yielded: _Yieldable) -> bool:
805 try:

Callers

nothing calls this directly

Calls 6

handle_yieldMethod · 0.95
future_set_exc_infoFunction · 0.90
resultMethod · 0.80
doneMethod · 0.45

Tested by

no test coverage detected