forked from microsoft/debugpy
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Show chained exception frames in stack. Fixes microsoft#1042
- Loading branch information
Showing
8 changed files
with
129 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
src/debugpy/_vendored/pydevd/tests_python/test_frame_utils.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import sys | ||
from _pydevd_bundle.pydevd_constants import EXCEPTION_TYPE_USER_UNHANDLED | ||
|
||
|
||
def test_create_frames_list_from_traceback(): | ||
|
||
def method(): | ||
raise RuntimeError('first') | ||
|
||
def method1(): | ||
try: | ||
method() | ||
except Exception as e: | ||
raise RuntimeError('second') from e | ||
|
||
def method2(): | ||
try: | ||
method1() | ||
except Exception as e: | ||
raise RuntimeError('third') from e | ||
|
||
try: | ||
method2() | ||
except Exception as e: | ||
exc_type, exc_desc, trace_obj = sys.exc_info() | ||
frame = sys._getframe() | ||
|
||
from _pydevd_bundle.pydevd_frame_utils import create_frames_list_from_traceback | ||
frames_list = create_frames_list_from_traceback(trace_obj, frame, exc_type, exc_desc, exception_type=EXCEPTION_TYPE_USER_UNHANDLED) | ||
assert str(frames_list.exc_desc) == 'third' | ||
assert str(frames_list.chained_frames_list.exc_desc) == 'second' | ||
assert str(frames_list.chained_frames_list.chained_frames_list.exc_desc) == 'first' | ||
assert frames_list.chained_frames_list.chained_frames_list.chained_frames_list is None | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters