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

Commit

Permalink
Only set PyDB as the global debugger after it's initialized. Fixes #1688
Browse files Browse the repository at this point in the history
  • Loading branch information
fabioz authored and karthiknadig committed Aug 13, 2019
1 parent 152edeb commit 46e1b75
Showing 1 changed file with 6 additions and 1 deletion.
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

0 comments on commit 46e1b75

Please sign in to comment.