From a8ca44f4620e021c12ca9ca33c8e45c2f6ac1678 Mon Sep 17 00:00:00 2001 From: Andrey Lisin Date: Mon, 9 Sep 2024 15:37:35 +0200 Subject: [PATCH] PY-75228 Fix issue with newly added breakpoints being ignored during debugging in Python 3.12 GitOrigin-RevId: 8a2b591dff069a2531d6af472955fbc62c4e531d --- .../pydevd_pep_669_tracing_wrapper.py | 10 +++++++++ python/helpers/pydev/pydevd.py | 21 +++++++++++++++---- 2 files changed, 27 insertions(+), 4 deletions(-) diff --git a/python/helpers/pydev/_pydevd_bundle/pydevd_pep_669_tracing_wrapper.py b/python/helpers/pydev/_pydevd_bundle/pydevd_pep_669_tracing_wrapper.py index ca9df0f68a84..91523dd9c67e 100644 --- a/python/helpers/pydev/_pydevd_bundle/pydevd_pep_669_tracing_wrapper.py +++ b/python/helpers/pydev/_pydevd_bundle/pydevd_pep_669_tracing_wrapper.py @@ -16,3 +16,13 @@ else: sys.modules['_pydevd_bundle.pydevd_pep_669_tracing'] = mod enable_pep669_monitoring = mod.enable_pep669_monitoring +global_cache_skips = mod.global_cache_skips +global_cache_frame_skips = mod.global_cache_frame_skips + +try: + restart_events = sys.monitoring.restart_events +except AttributeError: + def _dummy_restart_events(): + pass + + restart_events = _dummy_restart_events \ No newline at end of file diff --git a/python/helpers/pydev/pydevd.py b/python/helpers/pydev/pydevd.py index 30a7d9753c25..21f092b51b36 100644 --- a/python/helpers/pydev/pydevd.py +++ b/python/helpers/pydev/pydevd.py @@ -57,11 +57,12 @@ from _pydevd_bundle.pydevd_custom_frames import CustomFramesContainer, custom_fr from _pydevd_bundle.pydevd_frame_utils import add_exception_to_frame, remove_exception_from_frame from _pydevd_bundle.pydevd_kill_all_pydevd_threads import kill_all_pydev_threads from _pydevd_bundle.pydevd_trace_dispatch import ( - trace_dispatch as _trace_dispatch, global_cache_skips, global_cache_frame_skips, show_tracing_warning) + trace_dispatch as _trace_dispatch, show_tracing_warning) from _pydevd_frame_eval.pydevd_frame_eval_main import ( frame_eval_func, clear_thread_local_info, dummy_trace_dispatch, show_frame_eval_warning) -from _pydevd_bundle.pydevd_pep_669_tracing_wrapper import enable_pep669_monitoring +from _pydevd_bundle.pydevd_pep_669_tracing_wrapper import ( + enable_pep669_monitoring, restart_events) from _pydevd_bundle.pydevd_additional_thread_info import set_additional_thread_info from _pydevd_bundle.pydevd_utils import save_main_module, is_current_thread_main_thread, \ kill_thread @@ -520,6 +521,16 @@ class PyDB(object): self.is_pep669_monitoring_enabled = False + if USE_LOW_IMPACT_MONITORING: + from _pydevd_bundle.pydevd_pep_669_tracing_wrapper import ( + global_cache_skips, global_cache_frame_skips) + else: + from _pydevd_bundle.pydevd_trace_dispatch import ( + global_cache_skips, global_cache_frame_skips) + + self._global_cache_skips = global_cache_skips + self._global_cache_frame_skips = global_cache_frame_skips + self.value_resolve_thread_list = [] if set_as_global: @@ -922,8 +933,10 @@ class PyDB(object): self.clear_skip_caches() def clear_skip_caches(self): - global_cache_skips.clear() - global_cache_frame_skips.clear() + self._global_cache_skips.clear() + self._global_cache_frame_skips.clear() + if USE_LOW_IMPACT_MONITORING: + restart_events() def add_break_on_exception( self,