forked from DonJayamanne/pythonVSCode
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Closed
Labels
area-debuggingbugIssue identified by VS Code Team member as probable bugIssue identified by VS Code Team member as probable bug
Description
Environment data
- VS Code version: 1.21.1
- Extension version (available under the Extensions sidebar): 2018.3.1
- OS and version: Kubuntu 17.10 Kernel 4.13.0-38-generic 64bit
- Python version (& distribution if applicable, e.g. Anaconda): Python 3.6.3
- Type of virtual environment used (N/A | venv | virtualenv | conda | ...): venv
- Relevant/affected Python packages and their versions: All
Actual behavior
When debugging async/await code, if an exception is thrown, the debugger halts at the loop entry point instead of where the exception happened.
Expected behavior
The debugger should stop where the exception happens.
Steps to reproduce:
Run this code in the debugger:
import asyncio
def error():
raise Exception('Something bad happened')
async def main():
print('Hello world.')
await asyncio.sleep(1)
# Expectation: Debugger should stop here
error()
await asyncio.sleep(1)
print('Bye.')
loop = asyncio.get_event_loop()
# Actual: Debugger stops here.
loop.run_until_complete(main())
Logs
Output for Python in the Output panel (View→Output, change the drop-down the upper-right of the Output panel to Python)
Linter 'pylint' is not installed. Please install it or select another linter".
Error: Module 'pylint' not installed.
Output from Console under the Developer Tools panel (toggle Developer Tools on under Help)
~/python/async_exception_debugging$ cd /home/username/python/async_exception_debugging ; env "PYTHONIOENCODING=UTF-8" "PYTHONUNBUFFERED=1" /home/username/python/async_exception_debugging/env/bin/python /home/username/.vscode/extensions/ms-python.python-2018.3.1/pythonFiles/PythonTools/visualstudio_py_launcher.py /home/username/python/async_exception_debugging 40845 34806ad9-833a-4524-8cd6-18ca4aa74f14 RedirectOutput,RedirectOutput /home/username/python/async_exception_debugging/app.py
Hello world.
Traceback (most recent call last):
File "/home/username/python/async_exception_debugging/app.py", line 16, in <module>
loop.run_until_complete(main())
File "/usr/lib/python3.6/asyncio/base_events.py", line 467, in run_until_complete
return future.result()
File "/home/username/python/async_exception_debugging/app.py", line 10, in main
error()
File "/home/username/python/async_exception_debugging/app.py", line 4, in error
raise Exception('Something bad happened')
Exception: Something bad happened
Metadata
Metadata
Assignees
Labels
area-debuggingbugIssue identified by VS Code Team member as probable bugIssue identified by VS Code Team member as probable bug