Takes some changes from pydevd to fix line numbers being None (#1734)

* Add missing subrepo tools

* Update parent

* git subrepo commit (merge) src/debugpy/_vendored/pydevd

subrepo:
  subdir:   "src/debugpy/_vendored/pydevd"
  merged:   "c81fc701"
upstream:
  origin:   "https://github.com/fabioz/PyDev.Debugger.git"
  branch:   "main"
  commit:   "d0f81de4"
git-subrepo:
  version:  "0.4.9"
  origin:   "???"
  commit:   "???"

* Update sys_monitoring c file

* Try avoiding test errors on shutdown

* Try fixing case where closing early

* Run PRs everywhere
This commit is contained in:
Rich Chiodo 2024-11-14 16:22:19 -08:00 committed by GitHub
parent 3573ca0e2b
commit 73be8fb5df
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
29 changed files with 6265 additions and 6358 deletions

1
.gitignore vendored
View file

@ -13,7 +13,6 @@ __pycache__/
# Distribution / packaging
.Python
env/
build/
develop-eggs/
dist/
downloads/

View file

@ -9,13 +9,10 @@ trigger:
- release/*
# Trigger pr builds for commits into master and any release branches
# Ignore draft PR's
pr:
branches:
include:
- main
- release/*
drafts: false
- '*'
variables:
architecture: x64

1
build/git-subrepo Submodule

@ -0,0 +1 @@
Subproject commit cce3d93e1ad5dbb93c54fb78bd0eeec576eb98fb

View file

@ -6,7 +6,7 @@
[subrepo]
remote = https://github.com/fabioz/PyDev.Debugger.git
branch = main
commit = cf2e47cbb81a7b4e159f10d56208f4d22ff5423d
parent = 942a2276127598ef84d06b7f7b889281c1047712
commit = d0f81de46ec51687ac24ae9598eb2615010a4b44
parent = 8ab4ee89e9ae9a926f711904900a27e3c96d43d4
method = merge
cmdver = 0.4.9

View file

@ -11,6 +11,7 @@ encoding//pydev_ipython/inputhookqt5.py=utf-8
encoding//pydev_ipython/inputhooktk.py=utf-8
encoding//pydev_ipython/inputhookwx.py=utf-8
encoding//pydev_ipython/version.py=utf-8
encoding//pydevd_attach_to_process/winappdbg/__init__.py=utf-8
encoding//pydevd_attach_to_process/winappdbg/breakpoint.py=utf-8
encoding//pydevd_attach_to_process/winappdbg/crash.py=utf-8
encoding//pydevd_attach_to_process/winappdbg/interactive.py=utf-8

View file

@ -203,7 +203,7 @@ def _encode_if_needed(obj):
elif isinstance(obj, bytes):
try:
return xmlrpclib.Binary(obj.decode(sys.stdin.encoding, 'replace').encode("ISO-8859-1", "xmlcharrefreplace"))
return xmlrpclib.Binary(obj.decode(sys.stdin.encoding, "replace").encode("ISO-8859-1", "xmlcharrefreplace"))
except:
return xmlrpclib.Binary(obj) # bytes already

View file

@ -458,7 +458,9 @@ def update_class_to_generate_init(class_to_generate):
# Note: added kwargs because some messages are expected to be extended by the user (so, we'll actually
# make all extendable so that we don't have to worry about which ones -- we loose a little on typing,
# but may be better than doing a allow list based on something only pointed out in the documentation).
class_to_generate["init"] = '''def __init__(self%(args)s, update_ids_from_dap=False, **kwargs): # noqa (update_ids_from_dap may be unused)
class_to_generate[
"init"
] = '''def __init__(self%(args)s, update_ids_from_dap=False, **kwargs): # noqa (update_ids_from_dap may be unused)
"""
%(docstring)s
"""

View file

@ -529,8 +529,7 @@ class _PyCodeToSource(object):
instruction = instructions[0]
new_line_index = op_offset_to_line.get(instruction.offset)
if new_line_index is not None:
if new_line_index is not None:
curr_line_index = new_line_index
curr_line_index = new_line_index
self._process_next(curr_line_index)
return self.writer.line_to_contents

View file

@ -82,125 +82,8 @@ def debug(s):
_Instruction = namedtuple("_Instruction", "opname, opcode, starts_line, argval, is_jump_target, offset, argrepr")
def _iter_as_bytecode_as_instructions_py2(co):
code = co.co_code
op_offset_to_line = dict(dis.findlinestarts(co))
labels = set(dis.findlabels(code))
bytecode_len = len(code)
i = 0
extended_arg = 0
free = None
op_to_name = opname
while i < bytecode_len:
c = code[i]
op = ord(c)
is_jump_target = i in labels
curr_op_name = op_to_name[op]
initial_bytecode_offset = i
i = i + 1
if op < HAVE_ARGUMENT:
yield _Instruction(
curr_op_name,
op,
_get_line(op_offset_to_line, initial_bytecode_offset, 0),
None,
is_jump_target,
initial_bytecode_offset,
"",
)
else:
oparg = ord(code[i]) + ord(code[i + 1]) * 256 + extended_arg
extended_arg = 0
i = i + 2
if op == EXTENDED_ARG:
extended_arg = oparg * 65536
if op in hasconst:
yield _Instruction(
curr_op_name,
op,
_get_line(op_offset_to_line, initial_bytecode_offset, 0),
co.co_consts[oparg],
is_jump_target,
initial_bytecode_offset,
repr(co.co_consts[oparg]),
)
elif op in hasname:
yield _Instruction(
curr_op_name,
op,
_get_line(op_offset_to_line, initial_bytecode_offset, 0),
co.co_names[oparg],
is_jump_target,
initial_bytecode_offset,
str(co.co_names[oparg]),
)
elif op in hasjrel:
argval = i + oparg
yield _Instruction(
curr_op_name,
op,
_get_line(op_offset_to_line, initial_bytecode_offset, 0),
argval,
is_jump_target,
initial_bytecode_offset,
"to " + repr(argval),
)
elif op in haslocal:
yield _Instruction(
curr_op_name,
op,
_get_line(op_offset_to_line, initial_bytecode_offset, 0),
co.co_varnames[oparg],
is_jump_target,
initial_bytecode_offset,
str(co.co_varnames[oparg]),
)
elif op in hascompare:
yield _Instruction(
curr_op_name,
op,
_get_line(op_offset_to_line, initial_bytecode_offset, 0),
cmp_op[oparg],
is_jump_target,
initial_bytecode_offset,
cmp_op[oparg],
)
elif op in hasfree:
if free is None:
free = co.co_cellvars + co.co_freevars
yield _Instruction(
curr_op_name,
op,
_get_line(op_offset_to_line, initial_bytecode_offset, 0),
free[oparg],
is_jump_target,
initial_bytecode_offset,
str(free[oparg]),
)
else:
yield _Instruction(
curr_op_name,
op,
_get_line(op_offset_to_line, initial_bytecode_offset, 0),
oparg,
is_jump_target,
initial_bytecode_offset,
str(oparg),
)
def iter_instructions(co):
if sys.version_info[0] < 3:
iter_in = _iter_as_bytecode_as_instructions_py2(co)
else:
iter_in = dis.Bytecode(co)
iter_in = dis.Bytecode(co)
iter_in = list(iter_in)
bytecode_to_instruction = {}
@ -327,7 +210,7 @@ if sys.version_info[:2] <= (3, 9):
try_except_info_lst = []
op_offset_to_line = dict(dis.findlinestarts(co))
op_offset_to_line = dict(entry for entry in dis.findlinestarts(co) if entry[1] is not None)
offset_to_instruction_idx = {}
@ -445,7 +328,7 @@ elif sys.version_info[:2] == (3, 10):
try_except_info_lst = []
op_offset_to_line = dict(dis.findlinestarts(co))
op_offset_to_line = dict(entry for entry in dis.findlinestarts(co) if entry[1] is not None)
offset_to_instruction_idx = {}
@ -645,7 +528,7 @@ class _Disassembler(object):
self.firstlineno = firstlineno
self.level = level
self.instructions = list(iter_instructions(co))
op_offset_to_line = self.op_offset_to_line = dict(dis.findlinestarts(co))
op_offset_to_line = self.op_offset_to_line = dict(entry for entry in dis.findlinestarts(co) if entry[1] is not None)
# Update offsets so that all offsets have the line index (and update it based on
# the passed firstlineno).

View file

@ -1344,9 +1344,8 @@ def internal_evaluate_expression(dbg, seq, thread_id, frame_id, expression, is_e
def _set_expression_response(py_db, request, error_message):
body = pydevd_schema.SetExpressionResponseBody(value='')
variables_response = pydevd_base_schema.build_response(request, kwargs={
'body':body, 'success':False, 'message': error_message})
body = pydevd_schema.SetExpressionResponseBody(value="")
variables_response = pydevd_base_schema.build_response(request, kwargs={"body": body, "success": False, "message": error_message})
py_db.writer.add_command(NetCommand(CMD_RETURN, 0, variables_response, is_json=True))
@ -1362,18 +1361,18 @@ def internal_set_expression_json(py_db, request, thread_id):
fmt = fmt.to_dict()
frame = py_db.find_frame(thread_id, frame_id)
exec_code = '%s = (%s)' % (expression, value)
exec_code = "%s = (%s)" % (expression, value)
try:
pydevd_vars.evaluate_expression(py_db, frame, exec_code, is_exec=True)
except (Exception, KeyboardInterrupt):
_set_expression_response(py_db, request, error_message='Error executing: %s' % (exec_code,))
_set_expression_response(py_db, request, error_message="Error executing: %s" % (exec_code,))
return
# Ok, we have the result (could be an error), let's put it into the saved variables.
frame_tracker = py_db.suspended_frames_manager.get_frame_tracker(thread_id)
if frame_tracker is None:
# This is not really expected.
_set_expression_response(py_db, request, error_message='Thread id: %s is not current thread id.' % (thread_id,))
_set_expression_response(py_db, request, error_message="Thread id: %s is not current thread id." % (thread_id,))
return
# Now that the exec is done, get the actual value changed to return.

File diff suppressed because it is too large Load diff

View file

@ -359,7 +359,6 @@ except ImportError:
def get_smart_step_into_variant_from_frame_offset(*args, **kwargs):
return None
# IFDEF CYTHON -- DONT EDIT THIS FILE (it is automatically generated)
# ELSE
# # Note: those are now inlined on cython.
@ -446,7 +445,6 @@ cdef class _TryExceptContainerObj:
#
# try_except_infos = None
#
#
# ENDIF
@ -945,7 +943,8 @@ cdef class PyDBFrame:
try:
func_lines = set()
for offset_and_lineno in dis.findlinestarts(frame.f_code):
func_lines.add(offset_and_lineno[1])
if offset_and_lineno[1] is not None:
func_lines.add(offset_and_lineno[1])
except:
# This is a fallback for implementations where we can't get the function
# lines -- i.e.: jython (in this case clients need to provide the function
@ -1813,9 +1812,7 @@ def fix_top_level_trace_and_get_trace_func(py_db, frame):
if top_level_thread_tracer is None:
# Stop in some internal place to report about unhandled exceptions
top_level_thread_tracer = TopLevelThreadTracerOnlyUnhandledExceptions(args)
additional_info.top_level_thread_tracer_unhandled = (
top_level_thread_tracer
) # Hack for cython to keep it alive while the thread is alive (just the method in the SetTrace is not enough).
additional_info.top_level_thread_tracer_unhandled = top_level_thread_tracer # Hack for cython to keep it alive while the thread is alive (just the method in the SetTrace is not enough).
# print(' --> found to trace unhandled', f_unhandled.f_code.co_name, f_unhandled.f_code.co_filename, f_unhandled.f_code.co_firstlineno)
f_trace = top_level_thread_tracer.get_trace_dispatch_func()

View file

@ -101,7 +101,7 @@ def _patch_threading_to_hide_pydevd_threads():
{"_active_limbo_lock", "_limbo", "_active", "values", "list"},
{"_active_limbo_lock", "_limbo", "_active", "values", "NULL + list"},
{"NULL + list", "_active", "_active_limbo_lock", "NULL|self + values", "_limbo"},
{'_active_limbo_lock', 'values + NULL|self', '_limbo', '_active', 'list + NULL'},
{"_active_limbo_lock", "values + NULL|self", "_limbo", "_active", "list + NULL"},
):
pydev_log.debug("Applying patching to hide pydevd threads (Py3 version).")

View file

@ -25,7 +25,6 @@ except ImportError:
def get_smart_step_into_variant_from_frame_offset(*args, **kwargs):
return None
# IFDEF CYTHON
# cython_inline_constant: CMD_STEP_INTO = 107
# cython_inline_constant: CMD_STEP_INTO_MY_CODE = 144
@ -124,7 +123,6 @@ class _TryExceptContainerObj(object):
try_except_infos = None
# ENDIF
@ -623,7 +621,8 @@ class PyDBFrame:
try:
func_lines = set()
for offset_and_lineno in dis.findlinestarts(frame.f_code):
func_lines.add(offset_and_lineno[1])
if offset_and_lineno[1] is not None:
func_lines.add(offset_and_lineno[1])
except:
# This is a fallback for implementations where we can't get the function
# lines -- i.e.: jython (in this case clients need to provide the function

View file

@ -124,7 +124,7 @@ def update_globals_and_locals(updated_globals, initial_globals, frame):
if key in f_locals:
f_locals[key] = None
except Exception as e:
pydev_log.info('Unable to remove key: %s from locals. Exception: %s', key, e)
pydev_log.info("Unable to remove key: %s from locals. Exception: %s", key, e)
if f_locals is not None:
save_locals(frame)

View file

@ -187,9 +187,7 @@ def fix_top_level_trace_and_get_trace_func(py_db, frame):
if top_level_thread_tracer is None:
# Stop in some internal place to report about unhandled exceptions
top_level_thread_tracer = TopLevelThreadTracerOnlyUnhandledExceptions(args)
additional_info.top_level_thread_tracer_unhandled = (
top_level_thread_tracer
) # Hack for cython to keep it alive while the thread is alive (just the method in the SetTrace is not enough).
additional_info.top_level_thread_tracer_unhandled = top_level_thread_tracer # Hack for cython to keep it alive while the thread is alive (just the method in the SetTrace is not enough).
# print(' --> found to trace unhandled', f_unhandled.f_code.co_name, f_unhandled.f_code.co_filename, f_unhandled.f_code.co_firstlineno)
f_trace = top_level_thread_tracer.get_trace_dispatch_func()

View file

@ -59,7 +59,7 @@ def _get_code_line_info(code_obj):
last_line = None
for offset, line in dis.findlinestarts(code_obj):
if line is not None and offset is not None:
if line is not None:
line_to_offset[line] = offset
if line_to_offset:

View file

@ -19,7 +19,6 @@ from _pydevd_frame_eval.vendored.bytecode.instr import (
_check_arg_int,
)
# - jumps use instruction
# - lineno use bytes (dis.findlinestarts(code))
# - dis displays bytes
@ -169,7 +168,7 @@ class ConcreteBytecode(_bytecode._BaseBytecodeList):
@staticmethod
def from_code(code, *, extended_arg=False):
line_starts = dict(dis.findlinestarts(code))
line_starts = dict(entry for entry in dis.findlinestarts(code) if entry[1] is not None)
# find block starts
instructions = []

View file

@ -34,7 +34,6 @@ from _pydevd_bundle.pydevd_trace_dispatch import is_unhandled_exception
from _pydevd_bundle.pydevd_breakpoints import stop_on_unhandled_exception
from _pydevd_bundle.pydevd_utils import get_clsname_for_code
# fmt: off
# IFDEF CYTHON
# import cython
@ -168,6 +167,7 @@ def _get_bootstrap_frame(depth: int) -> Tuple[Optional[FrameType], bool]:
return f_bootstrap, is_bootstrap_frame_internal
# fmt: off
# IFDEF CYTHON
# cdef _get_unhandled_exception_frame(exc, int depth):
@ -373,6 +373,7 @@ def _create_thread_info(depth):
# cdef str co_name
# ELSE
class FuncCodeInfo:
# ENDIF
# fmt: on
def __init__(self):
@ -496,7 +497,7 @@ def _get_code_line_info(code_obj, _cache={}) -> _CodeLineInfo:
last_line = None
for offset, line in dis.findlinestarts(code_obj):
if offset is not None and line is not None:
if line is not None:
line_to_offset[line] = offset
if len(line_to_offset):
@ -868,7 +869,6 @@ def _unwind_event(code, instruction, exc):
if thread_info is None:
return
py_db: object = GlobalDebuggerHolder.global_dbg
if py_db is None or py_db.pydb_disposed:
return
@ -890,7 +890,6 @@ def _unwind_event(code, instruction, exc):
py_db.break_on_caught_exceptions or py_db.break_on_user_uncaught_exceptions or py_db.has_plugin_exception_breaks
)
if has_caught_exception_breakpoint_in_pydb:
_should_stop, frame, user_uncaught_exc_info = should_stop_on_exception(
py_db, thread_info.additional_info, frame, thread_info.thread, arg, None, is_unwind=True
@ -1688,7 +1687,6 @@ def _start_method_event(code, instruction_offset):
# threads may still want it...
return
frame = _getframe(1)
func_code_info = _get_func_code_info(code, frame)
if func_code_info.always_skip_code:
@ -1736,6 +1734,7 @@ def _start_method_event(code, instruction_offset):
return monitor.DISABLE
# fmt: off
# IFDEF CYTHON
# cpdef _ensure_monitoring():
@ -1808,7 +1807,7 @@ def stop_monitoring(all_threads=False):
thread_info.trace = False
def update_monitor_events(suspend_requested: Optional[bool] = None) -> None:
def update_monitor_events(suspend_requested: Optional[bool]=None) -> None:
"""
This should be called when breakpoints change.
@ -1939,7 +1938,6 @@ def _do_wait_suspend(py_db, thread_info, frame, event, arg):
thread_info.additional_info.trace_suspend_type = "sys_monitor"
py_db.do_wait_suspend(thread_info.thread, frame, event, arg)
# This can be used to diagnose exceptions inside of the debugger itself.
#
# import types

View file

@ -40,7 +40,6 @@ from _pydevd_bundle.pydevd_trace_dispatch import is_unhandled_exception
from _pydevd_bundle.pydevd_breakpoints import stop_on_unhandled_exception
from _pydevd_bundle.pydevd_utils import get_clsname_for_code
# fmt: off
# IFDEF CYTHON -- DONT EDIT THIS FILE (it is automatically generated)
import cython
@ -174,6 +173,7 @@ cdef _get_bootstrap_frame(depth):
return f_bootstrap, is_bootstrap_frame_internal
# fmt: off
# IFDEF CYTHON -- DONT EDIT THIS FILE (it is automatically generated)
cdef _get_unhandled_exception_frame(exc, int depth):
@ -379,6 +379,7 @@ cdef class FuncCodeInfo:
cdef str co_name
# ELSE
# class FuncCodeInfo:
#
# ENDIF
# fmt: on
def __init__(self):
@ -502,7 +503,7 @@ cdef _CodeLineInfo _get_code_line_info(code_obj, _cache={}):
last_line = None
for offset, line in dis.findlinestarts(code_obj):
if offset is not None and line is not None:
if line is not None:
line_to_offset[line] = offset
if len(line_to_offset):
@ -874,7 +875,6 @@ cdef _unwind_event(code, instruction, exc):
if thread_info is None:
return
py_db: object = GlobalDebuggerHolder.global_dbg
if py_db is None or py_db.pydb_disposed:
return
@ -896,7 +896,6 @@ cdef _unwind_event(code, instruction, exc):
py_db.break_on_caught_exceptions or py_db.break_on_user_uncaught_exceptions or py_db.has_plugin_exception_breaks
)
if has_caught_exception_breakpoint_in_pydb:
_should_stop, frame, user_uncaught_exc_info = should_stop_on_exception(
py_db, thread_info.additional_info, frame, thread_info.thread, arg, None, is_unwind=True
@ -1694,7 +1693,6 @@ cdef _start_method_event(code, instruction_offset):
# threads may still want it...
return
frame = _getframe(1)
func_code_info = _get_func_code_info(code, frame)
if func_code_info.always_skip_code:
@ -1742,6 +1740,7 @@ cdef _start_method_event(code, instruction_offset):
return monitor.DISABLE
# fmt: off
# IFDEF CYTHON -- DONT EDIT THIS FILE (it is automatically generated)
cpdef _ensure_monitoring():
@ -1814,7 +1813,7 @@ cpdef stop_monitoring(all_threads=False):
thread_info.trace = False
def update_monitor_events(suspend_requested: Optional[bool] = None) -> None:
def update_monitor_events(suspend_requested: Optional[bool]=None) -> None:
"""
This should be called when breakpoints change.
@ -1945,7 +1944,6 @@ def _do_wait_suspend(py_db, ThreadInfo thread_info, frame, event, arg):
thread_info.additional_info.trace_suspend_type = "sys_monitor"
py_db.do_wait_suspend(thread_info.thread, frame, event, arg)
# This can be used to diagnose exceptions inside of the debugger itself.
#
# import types

View file

@ -7,8 +7,8 @@ Update cython-generated files (must update cython and then run build_tools/build
Create tag:
-----------
git tag pydev_debugger_3_2_1 -a -m "PyDev.Debugger 3.2.1"
git push --tags
git tag pydev_debugger_3_2_3 -a -m "PyDev.Debugger 3.2.3"
git push origin pydev_debugger_3_2_3
(pushing the tag does the release to PyPi now)

View file

@ -173,7 +173,7 @@ if SUPPORT_GEVENT:
if USE_CUSTOM_SYS_CURRENT_FRAMES_MAP:
from _pydevd_bundle.pydevd_constants import constructed_tid_to_last_frame
__version_info__ = (3, 2, 2)
__version_info__ = (3, 2, 3)
__version_info_str__ = []
for v in __version_info__:
__version_info_str__.append(str(v))
@ -255,6 +255,7 @@ TIMEOUT_FAST = 1.0 / 50
# PyDBCommandThread
# =======================================================================================================================
class PyDBCommandThread(PyDBDaemonThread):
def __init__(self, py_db):
PyDBDaemonThread.__init__(self, py_db)
self._py_db_command_thread_event = py_db._py_db_command_thread_event
@ -299,6 +300,7 @@ class PyDBCommandThread(PyDBDaemonThread):
# Non-daemon thread: guarantees that all data is written even if program is finished
# =======================================================================================================================
class CheckAliveThread(PyDBDaemonThread):
def __init__(self, py_db):
PyDBDaemonThread.__init__(self, py_db)
self.name = "pydevd.CheckAliveThread"
@ -731,6 +733,7 @@ class PyDB(object):
# in the namespace (and thus can't be relied upon unless the reference was previously
# saved).
if IS_IRONPYTHON:
# A partial() cannot be used in IronPython for sys.settrace.
def new_trace_dispatch(frame, event, arg):
return _trace_dispatch(self, frame, event, arg)
@ -791,11 +794,11 @@ class PyDB(object):
max_line = -1
min_line = sys.maxsize
for _, line in dis.findlinestarts(code_obj):
if line is not None and line > max_line:
max_line = line
if line is not None and line < min_line:
min_line = line
if line is not None:
if line > max_line:
max_line = line
if line < min_line:
min_line = line
try_except_infos = [x for x in try_except_infos if min_line <= x.try_line <= max_line]
return try_except_infos
@ -1010,7 +1013,7 @@ class PyDB(object):
abs_path = abs_path[0:i]
i = max(abs_path.rfind("/"), abs_path.rfind("\\"))
if i:
dirname = abs_path[i + 1 :]
dirname = abs_path[i + 1:]
# At this point, something as:
# "my_path\_pydev_runfiles\__init__.py"
# is now "_pydev_runfiles".
@ -1528,6 +1531,7 @@ class PyDB(object):
self._dap_messages_listeners.append(listener)
class _WaitForConnectionThread(PyDBDaemonThread):
def __init__(self, py_db):
PyDBDaemonThread.__init__(self, py_db)
self._server_socket = None
@ -1581,7 +1585,7 @@ class PyDB(object):
"""returns internal command queue for a given thread.
if new queue is created, notify the RDB about it"""
if thread_id.startswith("__frame__"):
thread_id = thread_id[thread_id.rfind("|") + 1 :]
thread_id = thread_id[thread_id.rfind("|") + 1:]
return self._cmd_queue[thread_id], self._thread_events[thread_id]
def post_method_as_internal_command(self, thread_id, method, *args, **kwargs):
@ -1758,7 +1762,7 @@ class PyDB(object):
# (so, clear the cache related to that).
self._running_thread_ids = {}
def process_internal_commands(self, process_thread_ids: Optional[tuple] = None):
def process_internal_commands(self, process_thread_ids: Optional[tuple]=None):
"""
This function processes internal commands.
"""
@ -1917,10 +1921,10 @@ class PyDB(object):
self,
thread,
stop_reason: int,
suspend_other_threads: bool = False,
suspend_other_threads: bool=False,
is_pause=False,
original_step_cmd: int = -1,
suspend_requested: bool = False,
original_step_cmd: int=-1,
suspend_requested: bool=False,
):
"""
:param thread:
@ -2731,6 +2735,7 @@ class PyDB(object):
class IDAPMessagesListener(object):
def before_send(self, message_as_dict):
"""
Called just before a message is sent to the IDE.
@ -3216,6 +3221,7 @@ def stoptrace():
class Dispatcher(object):
def __init__(self):
self.port = None
@ -3235,6 +3241,7 @@ class Dispatcher(object):
class DispatchReader(ReaderThread):
def __init__(self, dispatcher):
self.dispatcher = dispatcher
@ -3435,7 +3442,6 @@ def _internal_patch_stdin(py_db=None, sys=None, getpass_mod=None):
getpass_mod.getpass = getpass
# Dispatch on_debugger_modules_loaded here, after all primary py_db modules are loaded

View file

@ -28,7 +28,6 @@ import os
class BinaryDistribution(Distribution):
def is_pure(self):
return False
@ -60,7 +59,12 @@ data_files.append(
)
for root, dirs, files in os.walk(attach_to_process_dir):
for d in dirs:
data_files.append((make_rel(os.path.join(root, d)), [make_rel(os.path.join(root, d, f)) for f in os.listdir(os.path.join(root, d)) if accept_file(f)]))
data_files.append(
(
make_rel(os.path.join(root, d)),
[make_rel(os.path.join(root, d, f)) for f in os.listdir(os.path.join(root, d)) if accept_file(f)],
)
)
import pydevd

View file

@ -72,8 +72,7 @@ class TestCPython(unittest.TestCase):
return msg
@unittest.skipIf(IS_PY313_OR_GREATER and sys.platform == "linux",
"Flakey on Linux")
@unittest.skipIf(IS_PY313_OR_GREATER and sys.platform == "linux", "Flakey on Linux")
def test_completion_sockets_and_messages(self):
t, socket = self.create_connections()
self.socket = socket

View file

@ -149,7 +149,7 @@ def check(
assert tracer.lines_executed
if has_line_event_optimized_in_original_case:
lines = sorted(set(x[1] for x in dis.findlinestarts(new_code)))
lines = sorted(set(x[1] for x in dis.findlinestarts(new_code) if x[1] is not None))
new_line_contents = []
last_line = str(max(lines)) + " "
for l in contents.splitlines(keepends=True):

View file

@ -110,7 +110,10 @@ class TestStrings(SafeReprTestBase):
value = "A" * (SafeRepr.maxstring_outer + 10)
self.assert_shortened(value, "'" + "A" * 43690 + "..." + "A" * 21845 + "'")
self.assert_shortened([value], "['AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA']")
self.assert_shortened(
[value],
"['AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA']",
)
def test_str_largest_unchanged(self):
value = "A" * (SafeRepr.maxstring_outer)
@ -125,12 +128,18 @@ class TestStrings(SafeReprTestBase):
def test_str_list_largest_unchanged(self):
value = "A" * (SafeRepr.maxstring_inner)
self.assert_unchanged([value], "['AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA']")
self.assert_unchanged(
[value],
"['AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA']",
)
def test_str_list_smallest_changed(self):
value = "A" * (SafeRepr.maxstring_inner + 1)
self.assert_shortened([value], "['AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA']")
self.assert_shortened(
[value],
"['AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA']",
)
@pytest.mark.skipif(sys.version_info > (3, 0), reason="Py2 specific test")
def test_unicode_small(self):
@ -158,7 +167,10 @@ class TestStrings(SafeReprTestBase):
value = b"A" * (SafeRepr.maxstring_outer + 10)
self.assert_shortened(value, "b'" + "A" * 43690 + "..." + "A" * 21845 + "'")
self.assert_shortened([value], "[b'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA']")
self.assert_shortened(
[value],
"[b'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA']",
)
# @pytest.mark.skip(reason='not written') # TODO: finish!
# def test_bytearray_small(self):

View file

@ -2,7 +2,6 @@ import unittest
class MyTest(unittest.TestCase):
def test1(self):
print("--on-test-1")

View file

@ -55,15 +55,19 @@ def cli(pyfile):
def parse(args):
log.debug("Parsing argv: {0!r}", args)
try:
# Run the CLI parser in a subprocess, and capture its output.
output = subprocess.check_output(
[sys.executable, "-u", cli_parser.strpath] + args
)
try:
# Run the CLI parser in a subprocess, and capture its output.
output = subprocess.check_output(
[sys.executable, "-u", cli_parser.strpath] + args
)
# Deserialize the output and return the parsed argv and options.
argv, options = pickle.loads(output)
except subprocess.CalledProcessError as exc:
raise pickle.loads(exc.output)
# Deserialize the output and return the parsed argv and options.
argv, options = pickle.loads(output)
except subprocess.CalledProcessError as exc:
raise pickle.loads(exc.output)
except EOFError:
# We may have just been shutting down. If so, return an empty argv and options.
argv, options = [], {}
log.debug("Adjusted sys.argv: {0!r}", argv)
log.debug("Parsed options: {0!r}", options)