From b7eadf86e1418a5d098199c831f279c721e2bff3 Mon Sep 17 00:00:00 2001 From: Andrey Lisin Date: Mon, 2 Nov 2020 16:42:01 +0600 Subject: [PATCH] Check if thread should not be traced before logging traced debugger thread warning It's important to check the `pydev_do_not_trace` attribute before printing the warning because sometimes `run()` method's code is called in the same thread, e.g. in the `Dispatcher` class. The absence of this check leads to a confusing false-positive warning. GitOrigin-RevId: 62514d5cb99f0181631366d68fe914220fb168d7 --- python/helpers/pydev/_pydevd_bundle/pydevd_comm.py | 2 +- python/helpers/pydev/pydevd.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/python/helpers/pydev/_pydevd_bundle/pydevd_comm.py b/python/helpers/pydev/_pydevd_bundle/pydevd_comm.py index a612013e2e4a..dad6d962b953 100644 --- a/python/helpers/pydev/_pydevd_bundle/pydevd_comm.py +++ b/python/helpers/pydev/_pydevd_bundle/pydevd_comm.py @@ -235,7 +235,7 @@ class PyDBDaemonThread(threading.Thread): pydevd_tracing.SetTrace(None) # no debugging on this thread def _warn_pydevd_thread_is_traced(self): - if sys.gettrace(): + if self.pydev_do_not_trace and sys.gettrace(): pydevd_log(1, "The debugger thread '%s' is traced which may lead to debugging performance issues." % self.__class__.__name__) diff --git a/python/helpers/pydev/pydevd.py b/python/helpers/pydev/pydevd.py index 48f43f4da9cb..c80761c35633 100644 --- a/python/helpers/pydev/pydevd.py +++ b/python/helpers/pydev/pydevd.py @@ -1810,7 +1810,7 @@ class Dispatcher(object): self.port = port self.client = start_client(self.host, self.port) self.reader = DispatchReader(self) - self.reader.pydev_do_not_trace = False #we run reader in the same thread so we don't want to loose tracing + self.reader.pydev_do_not_trace = False # We run reader in the same thread so we don't want to loose tracing. self.reader.run() def close(self):