File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -130,7 +130,7 @@ def find_first_executable_line(code):
130130 return code .co_firstlineno
131131
132132def find_function (funcname , filename ):
133- cre = re .compile (r'def\s+%s(\s*\[.+\])?\s*[(]' % re .escape (funcname ))
133+ cre = re .compile (r'(?:async\s+)? def\s+%s(\s*\[.+\])?\s*[(]' % re .escape (funcname ))
134134 try :
135135 fp = tokenize .open (filename )
136136 except OSError :
Original file line number Diff line number Diff line change @@ -4587,6 +4587,26 @@ def bar():
45874587 ]))
45884588 self .assertIn ('break in bar' , stdout )
45894589
4590+ def test_async_break (self ):
4591+ script = """
4592+ import asyncio
4593+
4594+ async def main():
4595+ print(f"Hello")
4596+ await asyncio.sleep(1)
4597+ print(f"World!")
4598+
4599+ asyncio.run(main())
4600+ """
4601+ commands = """
4602+ break main
4603+ continue
4604+ quit
4605+ """
4606+ stdout , stderr = self .run_pdb_script (script , commands )
4607+ self .assertIn ("Breakpoint 1 at" , stdout )
4608+ self .assertIn ("Hello" , stdout )
4609+
45904610
45914611class ChecklineTests (unittest .TestCase ):
45924612 def setUp (self ):
You can’t perform that action at this time.
0 commit comments