Run source code that contains await by playing with async shim frame
(self, source, globals, locals)
| 897 | return True |
| 898 | |
| 899 | def _exec_await(self, source, globals, locals): |
| 900 | """ Run source code that contains await by playing with async shim frame""" |
| 901 | # Put the source in an async function |
| 902 | source_async = ( |
| 903 | "async def __pdb_await():\n" + |
| 904 | textwrap.indent(source, " ") + '\n' + |
| 905 | " __pdb_locals.update(locals())" |
| 906 | ) |
| 907 | ns = globals | locals |
| 908 | # We use __pdb_locals to do write back |
| 909 | ns["__pdb_locals"] = locals |
| 910 | exec(source_async, ns) |
| 911 | self.async_awaitable = ns["__pdb_await"]() |
| 912 | |
| 913 | def _read_code(self, line): |
| 914 | buffer = line |