Skip to content
This repository has been archived by the owner on Aug 2, 2023. It is now read-only.

Unhandled exception breaks on the wrong line in with block #814

Closed
huguesv opened this issue Sep 17, 2018 · 0 comments
Closed

Unhandled exception breaks on the wrong line in with block #814

huguesv opened this issue Sep 17, 2018 · 0 comments

Comments

@huguesv
Copy link
Contributor

huguesv commented Sep 17, 2018

Environment data

  • PTVSD version: 4.1.2
  • OS and version: Windows
  • Python version (& distribution if applicable, e.g. Anaconda): Python 3.6 64-bit
  • Using VS Code or Visual Studio: Visual Studio 2017 15.8

Actual behavior

Debugger breaks on the last line of the with block ie print('done') line

Expected behavior

Debugger breaks on the line that causes the exception inside the with block ie json.loads line

Steps to reproduce:

Use this code (assumes a hello.json file is present). Note that json module was not imported, which will cause an exception to be raised.:

with open('hello.json') as f:
    text = json.loads(f)
    print(text)
    print('done')

Start debugging.
Exception is reported on line 4, instead of line 2

By comparison, this code behaves as expected, breaks on line 2

f = open('hello.json')
text = json.loads(f)
print(text)
print('done')
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants