return code.co_firstlineno
def find_function(funcname, filename):
- cre = re.compile(r'def\s+%s(\s*\[.+\])?\s*[(]' % re.escape(funcname))
+ cre = re.compile(r'(?:async\s+)?def\s+%s(\s*\[.+\])?\s*[(]' % re.escape(funcname))
try:
fp = tokenize.open(filename)
except OSError:
]))
self.assertIn('break in bar', stdout)
+ @unittest.skipIf(SKIP_CORO_TESTS, "Coroutine tests are skipped")
+ def test_async_break(self):
+ script = """
+ import asyncio
+
+ async def main():
+ pass
+
+ asyncio.run(main())
+ """
+ commands = """
+ break main
+ continue
+ quit
+ """
+ stdout, stderr = self.run_pdb_script(script, commands)
+ self.assertRegex(stdout, r"Breakpoint 1 at .*main\.py:5")
+ self.assertIn("pass", stdout)
+
def test_issue_59000(self):
script = """
def foo():