Debugger: do not stop on exceptions thrown inside pydev-debugger with on raise setting set (PY-15502)

Ignore some inner exceptions while importing in Python 3 and with import hooks.
This commit is contained in:
Elizaveta Shashkova
2015-04-27 17:51:36 +03:00
parent c234c7e41b
commit cc2c199b7b
+17 -2
View File
@@ -1,3 +1,5 @@
from pydevd_constants import IS_PY3K
class Frame(object):
def __init__(
self,
@@ -27,12 +29,25 @@ class FCode(object):
def add_exception_to_frame(frame, exception_info):
frame.f_locals['__exception__'] = exception_info
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
if trace.tb_next is None:
if IS_PY3K:
if trace.tb_frame.f_code.co_filename != '<frozen importlib._bootstrap>':
# Do not stop on inner exceptions in py3 while importing
return True
else:
return True
if trace.tb_next is not None:
filename = trace.tb_next.tb_frame.f_code.co_filename
# ImportError should appear in a user's code, not inside debugger
for file in FILES_WITH_IMPORT_HOOKS:
if filename.endswith(file):
return True
return False
def cached_call(obj, func, *args):
cached_name = '_cached_' + func.__name__