MCPcopy Create free account
hub / github.com/ipython/ipython / _pseudo_sync_runner

Function _pseudo_sync_runner

IPython/core/async_helpers.py:58–75  ·  view source on GitHub ↗

A runner that does not really allow async execution, and just advance the coroutine. See discussion in https://github.com/python-trio/trio/issues/608, Credit to Nathaniel Smith

(coro)

Source from the content-addressed store, hash-verified

56
57
58def _pseudo_sync_runner(coro):
59 """
60 A runner that does not really allow async execution, and just advance the coroutine.
61
62 See discussion in https://github.com/python-trio/trio/issues/608,
63
64 Credit to Nathaniel Smith
65
66 """
67 try:
68 coro.send(None)
69 except StopIteration as exc:
70 return exc.value
71 else:
72 # TODO: do not raise but return an execution result with the right info.
73 raise RuntimeError(
74 "{coro_name!r} needs a real async loop".format(coro_name=coro.__name__)
75 )
76
77
78def _asyncify(code: str) -> str:

Callers

nothing calls this directly

Calls 1

formatMethod · 0.45

Tested by

no test coverage detected