Skip to content

Commit 4d86a42

Browse files
authored
Updates from pydevd (#1706)
* Changes from pushing to pydevd * Update some time outs to get flakey tests to pass * Fix string failure * String case backwards. Fixup test in pydevd * Using callstack for exception check not sufficient * Too restrictive on pydevd matching * Try somethign better than just checking 'pydev' * Retry a flakey test * Disable flakey tests * Another flakey test * Increase timeout for attach * Try upping timeout * Up watchdog timeout * Up some more timeouts * Try delaying shutdown of test apps * Don't output extra things that tests don't expect * Fix output differences in 3.9? Not sure what that's about * Fixup line differences in 3.9 with extra sleep * Fix linter errors * Fix breakpoint bugs
1 parent 39879bd commit 4d86a42

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+5396
-4872
lines changed

pyproject.toml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ exclude = [
6464
"versioneer.py",
6565
"src/debugpy/_vendored/pydevd"
6666
]
67-
per-file-ignores = {}
6867

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

7574
# Assume Python 3.8
76-
target-version = "py38"
75+
target-version = "py38"
76+
77+
[tool.ruff.per-file-ignores]
78+
"tests/debugpy/test_breakpoints.py" = ["F841"]
79+
"tests/debugpy/test_output.py" = ["F841"]

pytest.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[pytest]
22
testpaths=tests
3-
timeout=30
3+
timeout=60
44
timeout_method=thread
55
addopts=-n8

src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_cython.c

Lines changed: 195 additions & 187 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_cython.pyx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1375,12 +1375,12 @@ cdef class PyDBFrame:
13751375

13761376

13771377
# IFDEF CYTHON -- DONT EDIT THIS FILE (it is automatically generated)
1378-
def should_stop_on_exception(py_db, PyDBAdditionalThreadInfo info, frame, thread, arg, prev_user_uncaught_exc_info):
1378+
def should_stop_on_exception(py_db, PyDBAdditionalThreadInfo info, frame, thread, arg, prev_user_uncaught_exc_info, is_unwind=False):
13791379
cdef bint should_stop;
13801380
cdef bint was_just_raised;
13811381
cdef list check_excs;
13821382
# ELSE
1383-
# def should_stop_on_exception(py_db, info, frame, thread, arg, prev_user_uncaught_exc_info):
1383+
# def should_stop_on_exception(py_db, info, frame, thread, arg, prev_user_uncaught_exc_info, is_unwind=False):
13841384
# ENDIF
13851385

13861386
should_stop = False
@@ -1397,7 +1397,7 @@ def should_stop_on_exception(py_db, PyDBAdditionalThreadInfo info, frame, thread
13971397
exception_breakpoint = None
13981398
try:
13991399
if py_db.plugin is not None:
1400-
result = py_db.plugin.exception_break(py_db, frame, thread, arg)
1400+
result = py_db.plugin.exception_break(py_db, frame, thread, arg, is_unwind)
14011401
if result:
14021402
should_stop, frame = result
14031403
except:
@@ -1417,7 +1417,7 @@ def should_stop_on_exception(py_db, PyDBAdditionalThreadInfo info, frame, thread
14171417
pass
14181418

14191419
else:
1420-
was_just_raised = just_raised(trace)
1420+
was_just_raised = trace.tb_next is None
14211421

14221422
# It was not handled by any plugin, lets check exception breakpoints.
14231423
check_excs = []

src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_frame.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1053,12 +1053,12 @@ def trace_dispatch(self, frame, event, arg):
10531053

10541054

10551055
# IFDEF CYTHON
1056-
# def should_stop_on_exception(py_db, PyDBAdditionalThreadInfo info, frame, thread, arg, prev_user_uncaught_exc_info):
1056+
# def should_stop_on_exception(py_db, PyDBAdditionalThreadInfo info, frame, thread, arg, prev_user_uncaught_exc_info, is_unwind=False):
10571057
# cdef bint should_stop;
10581058
# cdef bint was_just_raised;
10591059
# cdef list check_excs;
10601060
# ELSE
1061-
def should_stop_on_exception(py_db, info, frame, thread, arg, prev_user_uncaught_exc_info):
1061+
def should_stop_on_exception(py_db, info, frame, thread, arg, prev_user_uncaught_exc_info, is_unwind=False):
10621062
# ENDIF
10631063

10641064
should_stop = False
@@ -1075,7 +1075,7 @@ def should_stop_on_exception(py_db, info, frame, thread, arg, prev_user_uncaught
10751075
exception_breakpoint = None
10761076
try:
10771077
if py_db.plugin is not None:
1078-
result = py_db.plugin.exception_break(py_db, frame, thread, arg)
1078+
result = py_db.plugin.exception_break(py_db, frame, thread, arg, is_unwind)
10791079
if result:
10801080
should_stop, frame = result
10811081
except:
@@ -1095,7 +1095,7 @@ def should_stop_on_exception(py_db, info, frame, thread, arg, prev_user_uncaught
10951095
pass
10961096

10971097
else:
1098-
was_just_raised = just_raised(trace)
1098+
was_just_raised = trace.tb_next is None
10991099

11001100
# It was not handled by any plugin, lets check exception breakpoints.
11011101
check_excs = []

src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_frame_utils.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
from _pydev_bundle import pydev_log
33
import itertools
44
from typing import Any, Dict
5-
import threading
65
from os.path import basename, splitext
76

87

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

4847

49-
_thread_local_info = threading.local()
50-
def flag_as_unwinding(trace):
51-
_thread_local_info._unwinding_trace = trace
5248

5349
def just_raised(trace):
5450
if trace is None:
5551
return False
5652

57-
if hasattr(_thread_local_info, "_unwinding_trace") and _thread_local_info._unwinding_trace is trace:
58-
return False
59-
6053
return trace.tb_next is None
6154

62-
def short_tb(exc_type, exc_value, exc_tb):
55+
def short_tb(exc_tb):
6356
traceback = []
6457
while exc_tb:
6558
traceback.append('{%r, %r, %r}' % (exc_tb.tb_frame.f_code.co_filename,
6659
exc_tb.tb_frame.f_code.co_name,
6760
exc_tb.tb_lineno))
6861
exc_tb = exc_tb.tb_next
69-
return 'Traceback: %s\nError: %s %r\n' % (' -> '.join(traceback), exc_type.__name__, str(exc_value))
62+
return 'Traceback: %s\n' % (' -> '.join(traceback))
7063

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

72+
def short_stack(frame):
73+
stack = []
74+
while frame:
75+
stack.append(short_frame(frame))
76+
frame = frame.f_back
77+
return 'Stack: %s\n' % (' -> '.join(stack))
78+
7979
def ignore_exception_trace(trace):
8080
while trace is not None:
8181
filename = trace.tb_frame.f_code.co_filename

src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_plugin_utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,9 +191,9 @@ def suspend(self, py_db, thread, frame, bp_type):
191191

192192
return None
193193

194-
def exception_break(self, py_db, frame, thread, arg):
194+
def exception_break(self, py_db, frame, thread, arg, is_unwind=False):
195195
for plugin in self.active_plugins:
196-
ret = plugin.exception_break(py_db, frame, thread, arg)
196+
ret = plugin.exception_break(py_db, frame, thread, arg, is_unwind)
197197
if ret is not None:
198198
return ret
199199

src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_process_net_command_json.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -765,6 +765,7 @@ def on_setfunctionbreakpoints_request(self, py_db, request):
765765
expression = None
766766

767767
breakpoints_set = []
768+
arguments.breakpoints = arguments.breakpoints or []
768769
for bp in arguments.breakpoints:
769770
hit_condition = self._get_hit_condition_expression(bp.get("hitCondition"))
770771
condition = bp.get("condition")
@@ -805,7 +806,7 @@ def on_setbreakpoints_request(self, py_db, request):
805806
btype = "jinja2-line"
806807

807808
breakpoints_set = []
808-
809+
arguments.breakpoints = arguments.breakpoints or []
809810
for source_breakpoint in arguments.breakpoints:
810811
source_breakpoint = SourceBreakpoint(**source_breakpoint)
811812
line = source_breakpoint.line

0 commit comments

Comments
 (0)