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

Only set PyDB as the global debugger after it's initialized. Fixes #1688 #1690

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/ptvsd/_vendored/pydevd/pydevd.py
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,6 @@ class PyDB(object):

def __init__(self, set_as_global=True):
if set_as_global:
set_global_debugger(self)
pydevd_tracing.replace_sys_set_trace_func()

self.reader = None
Expand Down Expand Up @@ -528,6 +527,10 @@ def new_trace_dispatch(frame, event, arg):
self._apply_filter_cache = {}
self._ignore_system_exit_codes = set()

if set_as_global:
# Set as the global instance only after it's initialized.
set_global_debugger(self)

def on_configuration_done(self):
'''
Note: only called when using the DAP (Debug Adapter Protocol).
Expand Down Expand Up @@ -1515,6 +1518,8 @@ def send_caught_exception_stack_proceeded(self, thread):
def send_process_created_message(self):
"""Sends a message that a new process has been created.
"""
if self.writer is None or self.cmd_factory is None:
return
cmd = self.cmd_factory.make_process_created_message()
self.writer.add_command(cmd)

Expand Down