When the module is loaded when debugger is attached, the debugger directly intercepts the creation of the code object for code of that module, and uses information in that object (and specifically,
) to create the VS module object. This works because
is always .py.
However, when you attach to a process that is already running and had loaded some modules, there's no way to enumerate all existing code objects in it. So our fallback is to inspect sys.modules, and look at the
attribute of the objects inside. This breaks down here because
will actually use .pyc for anything other than the entry point module (when using python.exe), and the code that matches breakpoint filenames does not do anything special to match .py vs .pyc.