Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
Pyston
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
Pyston
Commits
7fb8d1d7
Commit
7fb8d1d7
authored
Jan 29, 2016
by
Dong-hee Na
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
implement tb_lineno of Traceback
parent
87602ccb
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
35 additions
and
2 deletions
+35
-2
src/runtime/traceback.cpp
src/runtime/traceback.cpp
+3
-1
src/runtime/traceback.h
src/runtime/traceback.h
+0
-1
test/tests/traceback_test2.py
test/tests/traceback_test2.py
+32
-0
No files found.
src/runtime/traceback.cpp
View file @
7fb8d1d7
...
...
@@ -145,7 +145,9 @@ void setupTraceback() {
NULL));
*/
traceback_cls
->
giveAttrDescriptor
(
"tb_next"
,
traceback_tb_next
,
NULL
);
traceback_cls
->
giveAttr
(
"tb_lineno"
,
new
BoxedMemberDescriptor
(
BoxedMemberDescriptor
::
INT
,
offsetof
(
BoxedTraceback
,
line
)
+
offsetof
(
LineInfo
,
line
)));
traceback_cls
->
freeze
();
}
}
src/runtime/traceback.h
View file @
7fb8d1d7
...
...
@@ -30,7 +30,6 @@ public:
Box
*
tb_next
;
LineInfo
line
;
Box
*
py_lines
;
BoxedTraceback
(
LineInfo
line
,
Box
*
tb_next
)
:
tb_next
(
tb_next
),
line
(
std
::
move
(
line
)),
py_lines
(
NULL
)
{}
DEFAULT_CLASS
(
traceback_cls
);
...
...
test/tests/traceback_test2.py
0 → 100644
View file @
7fb8d1d7
import
sys
,
traceback
def
lumberjack
():
bright_side_of_death
()
def
bright_side_of_death
():
return
tuple
()[
0
]
try
:
lumberjack
()
except
IndexError
:
exc_type
,
exc_value
,
exc_traceback
=
sys
.
exc_info
()
print
"*** print_tb:"
traceback
.
print_tb
(
exc_traceback
,
limit
=
1
,
file
=
sys
.
stdout
)
print
"*** print_exception:"
traceback
.
print_exception
(
exc_type
,
exc_value
,
exc_traceback
,
limit
=
2
,
file
=
sys
.
stdout
)
print
"*** print_exc:"
traceback
.
print_exc
()
print
"*** format_exc, first and last line:"
formatted_lines
=
traceback
.
format_exc
().
splitlines
()
print
formatted_lines
[
0
]
print
formatted_lines
[
-
1
]
print
"*** format_exception:"
print
repr
(
traceback
.
format_exception
(
exc_type
,
exc_value
,
exc_traceback
))
print
"*** extract_tb:"
print
repr
(
traceback
.
extract_tb
(
exc_traceback
))
print
"*** format_tb:"
print
repr
(
traceback
.
format_tb
(
exc_traceback
))
print
"*** tb_lineno:"
,
exc_traceback
.
tb_lineno
assert
exc_traceback
.
tb_lineno
==
10
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment