Files
openide/python/helpers/pydev/_pydevd_bundle/pydevd_frame_utils.py
Egor Eliseev bc8ecda30a PY-78884 Linux in Docker for PyCharm config PyEnvTestsDebugger
1. Do MultiProcessDebugger disconnect method synchronized.
2. Remove `getProcessHandler().waitFor()` from `PyDebugProcess#detachDebuggedProcess` (deadlock).
3. Add `kwargs` for `pydev_monkey#create_warn_multiproc` (new args in Python 3.13).
4. Ignore `BrokenPipeError` in `NetCommand#send` (could happen after debugging stops).
5. Handle `FrameLocalsProxy` (a new class for frame locals in Python 3.13)
6. Handle exceptions in all callbacks functions (PEP669)
7. Handle new bytecode instruction `CALL_KW` (Python 3.13 smart stem into)


Merge-request: IJ-MR-159198
Merged-by: Egor Eliseev <Egor.Eliseev@jetbrains.com>

GitOrigin-RevId: bae3df0980c231aea2ea4518ac0eed42959c989d
2025-04-03 11:02:02 +00:00

69 lines
1.8 KiB
Python

class Frame(object):
def __init__(
self,
f_back,
f_fileno,
f_code,
f_locals,
f_globals=None,
f_trace=None):
self.f_back = f_back
self.f_lineno = f_fileno
self.f_code = f_code
self.f_locals = f_locals
self.f_globals = f_globals
self.f_trace = f_trace
if self.f_globals is None:
self.f_globals = {}
class FCode(object):
def __init__(self, name, filename):
self.co_name = name
self.co_filename = filename
def add_exception_to_frame(frame, exception_info):
frame.f_locals['__exception__'] = exception_info
def remove_exception_from_frame(frame):
try:
frame.f_locals.pop('__exception__', None)
except:
if "__exception__" in frame.f_locals:
frame.f_locals["__exception__"] = None
FILES_WITH_IMPORT_HOOKS = ['pydev_monkey_qt.py', 'pydev_import_hook.py']
def just_raised(trace):
if trace is None:
return False
return trace.tb_next is None
def ignore_exception_trace(trace):
while trace is not None:
filename = trace.tb_frame.f_code.co_filename
if filename in (
'<frozen importlib._bootstrap>', '<frozen importlib._bootstrap_external>'):
# Do not stop on inner exceptions in py3 while importing
return True
# ImportError should appear in a user's code, not inside debugger
for file in FILES_WITH_IMPORT_HOOKS:
if filename.endswith(file):
return True
trace = trace.tb_next
return False
def cached_call(obj, func, *args):
cached_name = '_cached_' + func.__name__
if not hasattr(obj, cached_name):
setattr(obj, cached_name, func(*args))
return getattr(obj, cached_name)