Пример #1
0
 def callback():
     try:
         futures._chain_future(ensure_future(coro, loop=loop), future)
     except Exception as exc:
         if future.set_running_or_notify_cancel():
             future.set_exception(exc)
         raise
Пример #2
0
 def callback():
     try:
         futures._chain_future(ensure_future(coro, loop=loop), future)
     except Exception as exc:
         if future.set_running_or_notify_cancel():
             future.set_exception(exc)
         raise
Пример #3
0
        def callback():
            global repl_future
            global repl_future_interrupted

            repl_future = None
            repl_future_interrupted = False

            func = types.FunctionType(code, self.locals)
            try:
                coro = func()
            except SystemExit:
                raise
            except KeyboardInterrupt as ex:
                repl_future_interrupted = True
                future.set_exception(ex)
                return
            except BaseException as ex:
                future.set_exception(ex)
                return

            if not inspect.iscoroutine(coro):
                future.set_result(coro)
                return

            try:
                repl_future = self.loop.create_task(coro)
                futures._chain_future(repl_future, future)
            except BaseException as exc:
                future.set_exception(exc)
Пример #4
0
 def callback():
     try:
         futures._chain_future(ensure_future(coro, loop=loop), future)
     except (SystemExit, KeyboardInterrupt):
         raise
     except BaseException as exc:
         if future.set_running_or_notify_cancel():
             future.set_exception(exc)
         raise