mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
PY-32371 Fix stop after rerun with Console enabled
This commit is contained in:
@@ -7,7 +7,7 @@ import os
|
||||
|
||||
def breakpointhook(*args, **kwargs):
|
||||
# It's necessary to use inner function to add extra frame
|
||||
def breakpoint():
|
||||
def pydevd_breakpointhook():
|
||||
hookname = os.getenv('PYTHONBREAKPOINT')
|
||||
if hookname is not None and len(hookname) > 0 and hasattr(sys, '__breakpointhook__'):
|
||||
sys.__breakpointhook__(*args, **kwargs)
|
||||
@@ -22,21 +22,6 @@ def breakpointhook(*args, **kwargs):
|
||||
suspend=True,
|
||||
trace_only_current_thread=True,
|
||||
patch_multiprocessing=False,
|
||||
stop_at_frame=sys._getframe(),
|
||||
stop_at_frame=sys._getframe().f_back,
|
||||
)
|
||||
breakpoint()
|
||||
|
||||
|
||||
def install_breakpointhook(pydevd_breakpointhook=None):
|
||||
if pydevd_breakpointhook is None:
|
||||
pydevd_breakpointhook = breakpointhook
|
||||
if sys.version_info[0:2] >= (3, 7):
|
||||
# There are some choices on how to provide the breakpoint hook. Namely, we can provide a
|
||||
# PYTHONBREAKPOINT which provides the import path for a method to be executed or we
|
||||
# can override sys.breakpointhook.
|
||||
# pydevd overrides sys.breakpointhook instead of providing an environment variable because
|
||||
# it's possible that the debugger starts the user program but is not available in the
|
||||
# PYTHONPATH (and would thus fail to be imported if PYTHONBREAKPOINT was set to pydevd.settrace).
|
||||
# Note that the implementation still takes PYTHONBREAKPOINT in account (so, if it was provided
|
||||
# by someone else, it'd still work).
|
||||
sys.breakpointhook = pydevd_breakpointhook
|
||||
pydevd_breakpointhook()
|
||||
|
||||
@@ -34,7 +34,6 @@ from _pydevd_bundle.pydevd_comm import CMD_SET_BREAK, CMD_SET_NEXT_STATEMENT, CM
|
||||
set_global_debugger, WriterThread, pydevd_find_thread_by_id, pydevd_log, \
|
||||
start_client, start_server, InternalGetBreakpointException, InternalSendCurrExceptionTrace, \
|
||||
InternalSendCurrExceptionTraceProceeded
|
||||
from _pydevd_bundle.pydevd_breakpointhook import install_breakpointhook
|
||||
from _pydevd_bundle.pydevd_custom_frames import CustomFramesContainer, custom_frames_container_init
|
||||
from _pydevd_bundle.pydevd_frame_utils import add_exception_to_frame
|
||||
from _pydevd_bundle.pydevd_kill_all_pydevd_threads import kill_all_pydev_threads
|
||||
@@ -56,6 +55,22 @@ __version__ = '.'.join(__version_info_str__)
|
||||
|
||||
#IMPORTANT: pydevd_constants must be the 1st thing defined because it'll keep a reference to the original sys._getframe
|
||||
|
||||
|
||||
def install_breakpointhook(pydevd_breakpointhook=None):
|
||||
if pydevd_breakpointhook is None:
|
||||
from _pydevd_bundle.pydevd_breakpointhook import breakpointhook
|
||||
pydevd_breakpointhook = breakpointhook
|
||||
if sys.version_info[0:2] >= (3, 7):
|
||||
# There are some choices on how to provide the breakpoint hook. Namely, we can provide a
|
||||
# PYTHONBREAKPOINT which provides the import path for a method to be executed or we
|
||||
# can override sys.breakpointhook.
|
||||
# pydevd overrides sys.breakpointhook instead of providing an environment variable because
|
||||
# it's possible that the debugger starts the user program but is not available in the
|
||||
# PYTHONPATH (and would thus fail to be imported if PYTHONBREAKPOINT was set to pydevd.settrace).
|
||||
# Note that the implementation still takes PYTHONBREAKPOINT in account (so, if it was provided
|
||||
# by someone else, it'd still work).
|
||||
sys.breakpointhook = pydevd_breakpointhook
|
||||
|
||||
# Install the breakpoint hook at import time.
|
||||
install_breakpointhook()
|
||||
|
||||
|
||||
@@ -376,7 +376,7 @@ def cmd_step_over(plugin, main_debugger, frame, event, args, stop_info, stop):
|
||||
info.pydev_step_stop = frame.f_back
|
||||
info.pydev_django_resolve_frame = False
|
||||
thread.additional_info.suspend_type = DJANGO_SUSPEND
|
||||
stop = info.pydev_step_stop is frame and event in ('line', 'return')
|
||||
stop = info.pydev_step_stop is frame and event in ('line', 'return')
|
||||
return stop, plugin_stop
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user