def set_exception(self, exception, exc_info=None): """Store the exception and wake up any waiters. All greenlets blocking on :meth:`get` or :meth:`wait` are awakened. Subsequent calls to :meth:`wait` and :meth:`get` will not block at all. :keyword tuple exc_info: If given, a standard three-tuple of type, value, :class:`traceback` as returned by :func:`sys.exc_info`. This will be used when the exception is re-raised to propagate the correct traceback. """ if exc_info: self._exc_info = (exc_info[0], exc_info[1], dump_traceback(exc_info[2])) else: self._exc_info = (type(exception), exception, dump_traceback(None)) self._check_and_notify()
def _report_error(self, exc_info): if isinstance(exc_info[1], GreenletExit): self._report_result(exc_info[1]) return self._exc_info = exc_info[0], exc_info[1], dump_traceback(exc_info[2]) if self._links and not self._notifier: self._notifier = self.parent.loop.run_callback(self._notify_links) self.parent.handle_error(self, *exc_info)
def set_exception(self, exception, exc_info=None): """Store the exception. Wake up the waiters. All greenlets blocking on :meth:`get` or :meth:`wait` are woken up. Sequential calls to :meth:`wait` and :meth:`get` will not block at all. """ self._exception = exception if exc_info: self._exc_info = (exc_info[0], exc_info[1], dump_traceback(exc_info[2])) if self._links and not self._notifier: self._notifier = self.hub.loop.run_callback(self._notify_links)
def _report_error(self, exc_info): if isinstance(exc_info[1], GreenletExit): self._report_result(exc_info[1]) return self._exc_info = exc_info[0], exc_info[1], dump_traceback(exc_info[2]) if self._links and not self._notifier: self._notifier = self.parent.loop.run_callback(self._notify_links) try: self.parent.handle_error(self, *exc_info) finally: del exc_info
def __report_error(self, exc_info): if isinstance(exc_info[1], GreenletExit): self.__report_result(exc_info[1]) return self._exc_info = exc_info[0], exc_info[1], dump_traceback(exc_info[2]) hub = get_my_hub(self) # pylint:disable=undefined-variable if self._links and not self._notifier: self._notifier = hub.loop.run_callback(self._notify_links) try: hub.handle_error(self, *exc_info) finally: del exc_info
def _report_error(self, exc_info): if isinstance(exc_info[1], GreenletExit): self._report_result(exc_info[1]) return self._exc_info = exc_info[0], exc_info[1], dump_traceback(exc_info[2]) hub = get_my_hub(self) # pylint:disable=undefined-variable if self._links and not self._notifier: self._notifier = hub.loop.run_callback(self._notify_links) try: hub.handle_error(self, *exc_info) finally: del exc_info
def __report_error(self, exc_info): if isinstance(exc_info[1], GreenletExit): self.__report_result(exc_info[1]) return # Depending on the error, we may not be able to pickle it. # In particular, RecursionError can be a problem. try: tb = dump_traceback(exc_info[2]) except: # pylint:disable=bare-except tb = None self._exc_info = exc_info[0], exc_info[1], tb hub = get_my_hub(self) # pylint:disable=undefined-variable if self._links and not self._notifier: self._notifier = hub.loop.run_callback(self._notify_links) try: hub.handle_error(self, *exc_info) finally: del exc_info