Skip to content
Merged
Show file tree
Hide file tree
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: 5 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ exclude = [
"versioneer.py",
"src/debugpy/_vendored/pydevd"
]
per-file-ignores = {}

# Same as Black.
line-length = 88
Expand All @@ -73,4 +72,8 @@ line-length = 88
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"

# Assume Python 3.8
target-version = "py38"
target-version = "py38"

[tool.ruff.per-file-ignores]
"tests/debugpy/test_breakpoints.py" = ["F841"]
"tests/debugpy/test_output.py" = ["F841"]
2 changes: 1 addition & 1 deletion pytest.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[pytest]
testpaths=tests
timeout=30
timeout=60
timeout_method=thread
addopts=-n8
382 changes: 195 additions & 187 deletions src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_cython.c

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -1375,12 +1375,12 @@ cdef class PyDBFrame:


# IFDEF CYTHON -- DONT EDIT THIS FILE (it is automatically generated)
def should_stop_on_exception(py_db, PyDBAdditionalThreadInfo info, frame, thread, arg, prev_user_uncaught_exc_info):
def should_stop_on_exception(py_db, PyDBAdditionalThreadInfo info, frame, thread, arg, prev_user_uncaught_exc_info, is_unwind=False):
cdef bint should_stop;
cdef bint was_just_raised;
cdef list check_excs;
# ELSE
# def should_stop_on_exception(py_db, info, frame, thread, arg, prev_user_uncaught_exc_info):
# def should_stop_on_exception(py_db, info, frame, thread, arg, prev_user_uncaught_exc_info, is_unwind=False):
# ENDIF

should_stop = False
Expand All @@ -1397,7 +1397,7 @@ def should_stop_on_exception(py_db, PyDBAdditionalThreadInfo info, frame, thread
exception_breakpoint = None
try:
if py_db.plugin is not None:
result = py_db.plugin.exception_break(py_db, frame, thread, arg)
result = py_db.plugin.exception_break(py_db, frame, thread, arg, is_unwind)
if result:
should_stop, frame = result
except:
Expand All @@ -1417,7 +1417,7 @@ def should_stop_on_exception(py_db, PyDBAdditionalThreadInfo info, frame, thread
pass

else:
was_just_raised = just_raised(trace)
was_just_raised = trace.tb_next is None

# It was not handled by any plugin, lets check exception breakpoints.
check_excs = []
Expand Down
8 changes: 4 additions & 4 deletions src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -1053,12 +1053,12 @@ def trace_dispatch(self, frame, event, arg):


# IFDEF CYTHON
# def should_stop_on_exception(py_db, PyDBAdditionalThreadInfo info, frame, thread, arg, prev_user_uncaught_exc_info):
# def should_stop_on_exception(py_db, PyDBAdditionalThreadInfo info, frame, thread, arg, prev_user_uncaught_exc_info, is_unwind=False):
# cdef bint should_stop;
# cdef bint was_just_raised;
# cdef list check_excs;
# ELSE
def should_stop_on_exception(py_db, info, frame, thread, arg, prev_user_uncaught_exc_info):
def should_stop_on_exception(py_db, info, frame, thread, arg, prev_user_uncaught_exc_info, is_unwind=False):
# ENDIF

should_stop = False
Expand All @@ -1075,7 +1075,7 @@ def should_stop_on_exception(py_db, info, frame, thread, arg, prev_user_uncaught
exception_breakpoint = None
try:
if py_db.plugin is not None:
result = py_db.plugin.exception_break(py_db, frame, thread, arg)
result = py_db.plugin.exception_break(py_db, frame, thread, arg, is_unwind)
if result:
should_stop, frame = result
except:
Expand All @@ -1095,7 +1095,7 @@ def should_stop_on_exception(py_db, info, frame, thread, arg, prev_user_uncaught
pass

else:
was_just_raised = just_raised(trace)
was_just_raised = trace.tb_next is None

# It was not handled by any plugin, lets check exception breakpoints.
check_excs = []
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
from _pydev_bundle import pydev_log
import itertools
from typing import Any, Dict
import threading
from os.path import basename, splitext


Expand Down Expand Up @@ -46,27 +45,21 @@ def remove_exception_from_frame(frame):
FILES_WITH_IMPORT_HOOKS = ["pydev_monkey_qt.py", "pydev_import_hook.py"]


_thread_local_info = threading.local()
def flag_as_unwinding(trace):
_thread_local_info._unwinding_trace = trace

def just_raised(trace):
if trace is None:
return False

if hasattr(_thread_local_info, "_unwinding_trace") and _thread_local_info._unwinding_trace is trace:
return False

return trace.tb_next is None

def short_tb(exc_type, exc_value, exc_tb):
def short_tb(exc_tb):
traceback = []
while exc_tb:
traceback.append('{%r, %r, %r}' % (exc_tb.tb_frame.f_code.co_filename,
exc_tb.tb_frame.f_code.co_name,
exc_tb.tb_lineno))
exc_tb = exc_tb.tb_next
return 'Traceback: %s\nError: %s %r\n' % (' -> '.join(traceback), exc_type.__name__, str(exc_value))
return 'Traceback: %s\n' % (' -> '.join(traceback))

def short_frame(frame):
if frame is None:
Expand All @@ -76,6 +69,13 @@ def short_frame(frame):
name = splitext(basename(filename))[0]
return '%s::%s %s' % (name, frame.f_code.co_name, frame.f_lineno)

def short_stack(frame):
stack = []
while frame:
stack.append(short_frame(frame))
frame = frame.f_back
return 'Stack: %s\n' % (' -> '.join(stack))

def ignore_exception_trace(trace):
while trace is not None:
filename = trace.tb_frame.f_code.co_filename
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,9 +191,9 @@ def suspend(self, py_db, thread, frame, bp_type):

return None

def exception_break(self, py_db, frame, thread, arg):
def exception_break(self, py_db, frame, thread, arg, is_unwind=False):
for plugin in self.active_plugins:
ret = plugin.exception_break(py_db, frame, thread, arg)
ret = plugin.exception_break(py_db, frame, thread, arg, is_unwind)
if ret is not None:
return ret

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -765,6 +765,7 @@ def on_setfunctionbreakpoints_request(self, py_db, request):
expression = None

breakpoints_set = []
arguments.breakpoints = arguments.breakpoints or []
for bp in arguments.breakpoints:
hit_condition = self._get_hit_condition_expression(bp.get("hitCondition"))
condition = bp.get("condition")
Expand Down Expand Up @@ -805,7 +806,7 @@ def on_setbreakpoints_request(self, py_db, request):
btype = "jinja2-line"

breakpoints_set = []

arguments.breakpoints = arguments.breakpoints or []
for source_breakpoint in arguments.breakpoints:
source_breakpoint = SourceBreakpoint(**source_breakpoint)
line = source_breakpoint.line
Expand Down
Loading
Loading