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
cf2c2828
Commit
cf2c2828
authored
Jun 20, 2015
by
Kevin Modzelewski
Browse files
Options
Browse Files
Download
Plain Diff
Merge commit 'pr/624'
Conflicts: src/codegen/unwinding.cpp
parents
767a5193
e7355582
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
21 additions
and
15 deletions
+21
-15
src/codegen/unwinding.cpp
src/codegen/unwinding.cpp
+4
-4
src/codegen/unwinding.h
src/codegen/unwinding.h
+1
-1
src/runtime/stacktrace.cpp
src/runtime/stacktrace.cpp
+2
-2
src/runtime/traceback.cpp
src/runtime/traceback.cpp
+3
-5
src/runtime/traceback.h
src/runtime/traceback.h
+1
-3
test/tests/native_print_tb.py
test/tests/native_print_tb.py
+8
-0
tools/tester.py
tools/tester.py
+2
-0
No files found.
src/codegen/unwinding.cpp
View file @
cf2c2828
...
...
@@ -732,7 +732,7 @@ static std::unique_ptr<PythonFrameIteratorImpl> getTopPythonFrame() {
// 4. Unless we've hit the end of the stack, go to 2 and keep unwinding.
//
static
StatCounter
us_gettraceback
(
"us_gettraceback"
);
Box
edTraceback
*
getTraceback
()
{
Box
*
getTraceback
()
{
STAT_TIMER
(
t0
,
"us_timer_gettraceback"
,
20
);
if
(
!
ENABLE_FRAME_INTROSPECTION
)
{
static
bool
printed_warning
=
false
;
...
...
@@ -740,7 +740,7 @@ BoxedTraceback* getTraceback() {
printed_warning
=
true
;
fprintf
(
stderr
,
"Warning: can't get traceback since ENABLE_FRAME_INTROSPECTION=0
\n
"
);
}
return
new
BoxedTraceback
()
;
return
None
;
}
if
(
!
ENABLE_TRACEBACKS
)
{
...
...
@@ -749,12 +749,12 @@ BoxedTraceback* getTraceback() {
printed_warning
=
true
;
fprintf
(
stderr
,
"Warning: can't get traceback since ENABLE_TRACEBACKS=0
\n
"
);
}
return
new
BoxedTraceback
()
;
return
None
;
}
Timer
_t
(
"getTraceback"
,
1000
);
Box
*
tb
=
new
BoxedTraceback
()
;
Box
*
tb
=
None
;
unwindPythonStack
([
&
](
PythonFrameIteratorImpl
*
frame_iter
)
{
BoxedTraceback
::
here
(
lineInfoForFrame
(
frame_iter
),
&
tb
);
return
false
;
...
...
src/codegen/unwinding.h
View file @
cf2c2828
...
...
@@ -39,7 +39,7 @@ Box* getGlobals(); // returns either the module or a globals dict
Box
*
getGlobalsDict
();
// always returns a dict-like object
CompiledFunction
*
getCFForAddress
(
uint64_t
addr
);
Box
edTraceback
*
getTraceback
();
Box
*
getTraceback
();
class
PythonUnwindSession
;
PythonUnwindSession
*
beginPythonUnwindSession
();
...
...
src/runtime/stacktrace.cpp
View file @
cf2c2828
...
...
@@ -47,7 +47,7 @@ void showBacktrace() {
}
void
raiseExc
(
Box
*
exc_obj
)
{
throw
ExcInfo
(
exc_obj
->
cls
,
exc_obj
,
new
BoxedTraceback
()
);
throw
ExcInfo
(
exc_obj
->
cls
,
exc_obj
,
None
);
}
// Have a special helper function for syntax errors, since we want to include the location
...
...
@@ -245,7 +245,7 @@ ExcInfo excInfoForRaise(Box* type, Box* value, Box* tb) {
assert
(
PyExceptionClass_Check
(
type
));
if
(
tb
==
NULL
)
{
tb
=
new
BoxedTraceback
()
;
tb
=
None
;
}
return
ExcInfo
(
type
,
value
,
tb
);
...
...
src/runtime/traceback.cpp
View file @
cf2c2828
...
...
@@ -102,11 +102,9 @@ Box* BoxedTraceback::getLines(Box* b) {
if
(
!
tb
->
py_lines
)
{
BoxedList
*
lines
=
new
BoxedList
();
for
(
BoxedTraceback
*
wtb
=
tb
;
wtb
&&
wtb
!=
None
;
wtb
=
static_cast
<
BoxedTraceback
*>
(
wtb
->
tb_next
))
{
if
(
wtb
->
has_line
)
{
auto
&
line
=
wtb
->
line
;
auto
l
=
BoxedTuple
::
create
({
boxString
(
line
.
file
),
boxString
(
line
.
func
),
boxInt
(
line
.
line
)
});
listAppendInternal
(
lines
,
l
);
}
auto
&
line
=
wtb
->
line
;
auto
l
=
BoxedTuple
::
create
({
boxString
(
line
.
file
),
boxString
(
line
.
func
),
boxInt
(
line
.
line
)
});
listAppendInternal
(
lines
,
l
);
}
tb
->
py_lines
=
lines
;
}
...
...
src/runtime/traceback.h
View file @
cf2c2828
...
...
@@ -28,12 +28,10 @@ extern "C" BoxedClass* traceback_cls;
class
BoxedTraceback
:
public
Box
{
public:
Box
*
tb_next
;
bool
has_line
;
LineInfo
line
;
Box
*
py_lines
;
BoxedTraceback
(
LineInfo
line
,
Box
*
tb_next
)
:
tb_next
(
tb_next
),
has_line
(
true
),
line
(
line
),
py_lines
(
NULL
)
{}
BoxedTraceback
()
:
tb_next
(
None
),
has_line
(
false
),
line
(
-
1
,
-
1
,
""
,
""
),
py_lines
(
NULL
)
{}
BoxedTraceback
(
LineInfo
line
,
Box
*
tb_next
)
:
tb_next
(
tb_next
),
line
(
line
),
py_lines
(
NULL
)
{}
DEFAULT_CLASS
(
traceback_cls
);
...
...
test/tests/native_print_tb.py
0 → 100644
View file @
cf2c2828
import
sys
import
subprocess
me
=
sys
.
executable
p
=
subprocess
.
Popen
([
me
,
"-c"
,
"1/0"
],
stdout
=
subprocess
.
PIPE
)
print
p
.
stdout
.
read
()
tools/tester.py
View file @
cf2c2828
...
...
@@ -592,3 +592,5 @@ if __name__ == "__main__":
main(origdir)
finally:
shutil.rmtree(tmpdir)
# adding a comment here to invalidate cached expected results
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