Skip to content

Commit

Permalink
Update pydevd
Browse files Browse the repository at this point in the history
  • Loading branch information
fabioz committed Oct 17, 2024
1 parent 5e8e6de commit 0e8bd0c
Show file tree
Hide file tree
Showing 47 changed files with 6,014 additions and 4,364 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ jobs:
pip install psutil --no-warn-script-location
pip install ipython --no-warn-script-location
pip install untangle --no-warn-script-location
pip install importlib-metadata --no-warn-script-location
- name: Install Python 3.x deps
if: contains(matrix.name, 'py3') && !contains(matrix.name, 'pypy') && !contains(matrix.name, 'py312') && !contains(matrix.name, 'py311')
run: |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,10 @@ def _current_frames():
IS_PY310_OR_GREATER = sys.version_info >= (3, 10)
IS_PY311_OR_GREATER = sys.version_info >= (3, 11)
IS_PY312_OR_GREATER = sys.version_info >= (3, 12)
IS_PY313_OR_GREATER = sys.version_info >= (3, 13)

# Not currently supported in Python 3.12.
SUPPORT_ATTACH_TO_PID = not IS_PY312_OR_GREATER
SUPPORT_ATTACH_TO_PID = not IS_PY313_OR_GREATER


def version_str(v):
Expand Down
352 changes: 191 additions & 161 deletions plugins/org.python.pydev.core/pysrc/_pydevd_bundle/pydevd_cython.c

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -1374,12 +1374,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 @@ -1396,7 +1396,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 Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
'inputhookpyglet.py',
'inputhookqt4.py',
'inputhookqt5.py',
'inputhookqt6.py',
'inputhooktk.py',
'inputhookwx.py',
'matplotlibtools.py',
Expand Down
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 Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from _pydev_bundle import pydev_log
import itertools
from typing import Any, Dict
from os.path import basename, splitext


class Frame(object):
Expand Down Expand Up @@ -42,8 +43,32 @@ def remove_exception_from_frame(frame):
def just_raised(trace):
if trace is None:
return False

return trace.tb_next is None

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\n' % (' -> '.join(traceback))

def short_frame(frame):
if frame is None:
return 'None'

filename = frame.f_code.co_filename
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:
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
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class SafeRepr(object):
# most level, and truncated to maxstring_inner characters inside
# collections.
maxstring_outer = 2**16
maxstring_inner = 30
maxstring_inner = 128
string_types = (str, bytes)
bytes = bytes
set_info = (set, "{", "}", False)
Expand All @@ -30,7 +30,7 @@ class SafeRepr(object):

# Collection types are recursively iterated for each limit in
# maxcollection.
maxcollection = (15, 10)
maxcollection = (60, 20)

# Specifies type, prefix string, suffix string, and whether to include a
# comma if there is only one element. (Using a sequence rather than a
Expand Down Expand Up @@ -61,7 +61,7 @@ class SafeRepr(object):
# All other types are treated identically to strings, but using
# different limits.
maxother_outer = 2**16
maxother_inner = 30
maxother_inner = 128

convert_to_hex = False
raw_value = False
Expand Down
Loading

0 comments on commit 0e8bd0c

Please sign in to comment.