-
-
Notifications
You must be signed in to change notification settings - Fork 33.6k
Open
Labels
stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-featureA feature request or enhancementA feature request or enhancement
Description
Bug report
Bug description:
I found that while debugging with pdb you currently cannot set a breakpoint on an async function. Reproducer:
import asyncio
async def main():
print(f"Hello")
await asyncio.sleep(1)
print(f"World!")
asyncio.run(main())If you run pdb and try to set a breakpoint on main you get:
λ › ./python -m pdb main.py
> /cpython/main.py(1)<module>()
-> import asyncio
(Pdb) break main
*** The specified object 'main' is not a function or was not found along sys.path.
(Pdb) quit
This happens because the regular expression used by find_function does not match async functions:
Lines 132 to 133 in 2ff8608
| def find_function(funcname, filename): | |
| cre = re.compile(r'def\s+%s(\s*\[.+\])?\s*[(]' % re.escape(funcname)) |
CPython versions tested on:
CPython main branch
Operating systems tested on:
Linux
Linked PRs
Metadata
Metadata
Assignees
Labels
stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-featureA feature request or enhancementA feature request or enhancement