This project has moved. For the latest updates, please go here.

Inconsistent Stepping


PTVS has inconsistent behavior when stepping through code. When using "Step Over" sometimes it steps over and sometimes it steps into. Below is a script to reproduce the issue, machine and python config, and a video showing the problem with PTVS 2.1RC1. The problem is reproducible in PTVS2.0 as well.

def func(param1):
    temp = param1

def foo(param1):

def main():
    a_string = "A string"

if __name__ == "__main__":
  • breakpoint at a_string = "A string"
  • right click file and select "Start with Debugging"
  • step over a_string = "A string"
  • step over foo(a_string)
  • ptvs steps into foo(a_string)
Python 2.7.5 x86
Windows 7 x64
Visual Studio 2013

Video of bug:


pminaev wrote Aug 13, 2014 at 1:22 AM

Looking at the call stack in the video, it seems that you have mixed-mode debugging enabled (it shows a Native/Python transition at the entrypoint). "Start with debugging" will use the corresponding setting from your project properties, if the file is in a project. Is that intentionally set? If not - i.e. if it's not something that you're actually using - consider disabling it, as pure Python debugger is generally much more powerful and better polished, if all you care about is debugging Python code.

I tried to repro with both mixed-mode and pure debugging, and only mixed-mode seems to exhibit this behavior for me.

pminaev wrote Aug 13, 2014 at 1:27 AM

Additionally, it seems that it doesn't repro on Python 2.7.7 (the one machine that I do have a repro on is also on 2.7.5).

brianrackle wrote Aug 13, 2014 at 1:56 AM

Yea mixed mode is intentionally set because typically I am attaching to a running process. And we are forced to use Python 2.7.5 because that is what our software is currently shipping with.