Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates to sys.monitoring to get debugpy tests to pass #290

Merged
merged 38 commits into from
Oct 17, 2024
Merged
Show file tree
Hide file tree
Changes from 34 commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
6da7d9f
Updates from debugpy to get debugpy tests to pass
rchiodo Sep 17, 2024
02c1825
Remove logging
rchiodo Sep 17, 2024
6a12743
Update repr tests
rchiodo Sep 18, 2024
dfa917e
Fix last test failure, update cython output
rchiodo Sep 18, 2024
9d57c97
Put back unchanged modules
rchiodo Sep 18, 2024
45bd5e9
Update dlls after pr build in debugpy
rchiodo Sep 23, 2024
d87ccff
Merge remote-tracking branch 'upstream/main' into rchiodo/debugpy_upd…
rchiodo Oct 7, 2024
46e6092
Regenerate cython
rchiodo Oct 7, 2024
895c855
Remove some of the unnecessary logging
rchiodo Oct 8, 2024
f39c6ca
Remove just_raised logic, was failing a test
rchiodo Oct 8, 2024
06edbb3
Fix django problem a different way
rchiodo Oct 8, 2024
202499c
Forgot jinja plugin
rchiodo Oct 8, 2024
c23b513
Add django test that matches failure case in debugpy
rchiodo Oct 8, 2024
3778455
Add tests to verify changes
rchiodo Oct 9, 2024
7f808d4
Fix test for 3.12 and add more restrictions on jump/line check
rchiodo Oct 10, 2024
597018b
Remove extra logging and special cases in tests for 3_12
rchiodo Oct 10, 2024
3c9f6fa
Put back version for ipython
rchiodo Oct 10, 2024
a906bcc
Fix cython bits
rchiodo Oct 10, 2024
2665bca
Remove unnecessary file
rchiodo Oct 10, 2024
00defa9
Turn cython back on
rchiodo Oct 10, 2024
e29f955
Remove some more unnecessary logging
rchiodo Oct 10, 2024
4e4ee8f
Fix default argument for should_stop_on_exception in Cython
rchiodo Oct 11, 2024
873321b
Get test like debugpy has
rchiodo Oct 11, 2024
75bdfdf
Switch test to attach only
rchiodo Oct 11, 2024
e13e2cb
Skip flakey test on 3_12
rchiodo Oct 11, 2024
83f9bc5
Skip new test on pypy
rchiodo Oct 11, 2024
0ee463b
Disabling the flakey test
rchiodo Oct 11, 2024
83d21c5
Review feedback and update logic for f_unhandled cache
rchiodo Oct 14, 2024
faecb6b
Fix string problem and generate test for it
rchiodo Oct 15, 2024
b9b2626
Remove extra logging
rchiodo Oct 15, 2024
2cdcb7d
Merge branch 'rchiodo/debugpy_updates' of https://github.com/rchiodo/…
rchiodo Oct 15, 2024
36e11f0
Update cython files
rchiodo Oct 15, 2024
d0e781e
Weird difference in print for new test?
rchiodo Oct 15, 2024
c484988
Add importlib-metadata as dependency of tests
rchiodo Oct 15, 2024
f933c81
Remove unnecessary variable and make test reflect what it's testing
rchiodo Oct 15, 2024
7590236
Update cython output
rchiodo Oct 15, 2024
872a0d5
Make new test retry
rchiodo Oct 15, 2024
ff3e742
Remove unnecessary get_file_type check
rchiodo Oct 16, 2024
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
1 change: 1 addition & 0 deletions .github/workflows/pydevd-tests-python.yml
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
3 changes: 2 additions & 1 deletion _pydevd_bundle/pydevd_constants.py
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 _pydevd_bundle/pydevd_cython.c

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions _pydevd_bundle/pydevd_cython.pyx
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)
fabioz marked this conversation as resolved.
Show resolved Hide resolved
if result:
should_stop, frame = result
except:
Expand Down
1 change: 1 addition & 0 deletions _pydevd_bundle/pydevd_dont_trace_files.py
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
6 changes: 3 additions & 3 deletions _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 Down
25 changes: 25 additions & 0 deletions _pydevd_bundle/pydevd_frame_utils.py
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
4 changes: 2 additions & 2 deletions _pydevd_bundle/pydevd_plugin_utils.py
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
6 changes: 3 additions & 3 deletions _pydevd_bundle/pydevd_safe_repr.py
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
rchiodo marked this conversation as resolved.
Show resolved Hide resolved
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
Loading