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
1c3f474d
Commit
1c3f474d
authored
Jan 20, 2015
by
Kevin Modzelewski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix a couple issues and the sys_excinfo test is working
parent
67c85513
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
57 additions
and
38 deletions
+57
-38
src/codegen/ast_interpreter.cpp
src/codegen/ast_interpreter.cpp
+6
-0
src/core/cfg.cpp
src/core/cfg.cpp
+3
-0
test/tests/generator_tracebacks.py
test/tests/generator_tracebacks.py
+43
-0
test/tests/sys_excinfo.py
test/tests/sys_excinfo.py
+4
-37
tools/tester.py
tools/tester.py
+1
-1
No files found.
src/codegen/ast_interpreter.cpp
View file @
1c3f474d
...
...
@@ -622,6 +622,12 @@ Value ASTInterpreter::visit_yield(AST_Yield* node) {
}
Value
__attribute__
((
flatten
))
ASTInterpreter
::
visit_stmt
(
AST_stmt
*
node
)
{
if
(
0
)
{
printf
(
"%20s % 2d "
,
source_info
->
getName
().
c_str
(),
current_block
->
idx
);
print_ast
(
node
);
printf
(
"
\n
"
);
}
switch
(
node
->
type
)
{
case
AST_TYPE
:
:
Assert
:
return
visit_assert
((
AST_Assert
*
)
node
);
...
...
src/core/cfg.cpp
View file @
1c3f474d
...
...
@@ -1924,6 +1924,9 @@ public:
if
(
!
caught_all
)
{
AST_Raise
*
raise
=
new
AST_Raise
();
raise
->
arg0
=
makeName
(
exc_type_name
,
AST_TYPE
::
Load
,
node
->
lineno
);
raise
->
arg1
=
makeName
(
exc_value_name
,
AST_TYPE
::
Load
,
node
->
lineno
);
raise
->
arg2
=
makeName
(
exc_traceback_name
,
AST_TYPE
::
Load
,
node
->
lineno
);
push_back
(
raise
);
curblock
->
push_back
(
new
AST_Unreachable
());
curblock
=
NULL
;
...
...
test/tests/generator_tracebacks.py
0 → 100644
View file @
1c3f474d
# expected: fail
# - wip
# Generators participate in the notional Python stack just like normal function calls do,
# even if we implement them using separate C stacks.
#
# This matters both for tracebacks, and some related things like sys.exc_info which should
# get inherited when we go into a generator
# exc_info gets passed into generators (at both begin and send()) and cleared like normal on the way out:
def
f12
():
print
print
"f12"
print
"begin:"
,
sys
.
exc_info
()[
0
]
def
g
():
print
"start of generator:"
,
sys
.
exc_info
()[
0
]
yield
1
print
"after first yield:"
,
sys
.
exc_info
()[
0
]
try
:
raise
KeyError
()
except
:
pass
print
"after KeyError:"
,
sys
.
exc_info
()[
0
]
yield
2
try
:
raise
AttributeError
()
except
:
pass
i
=
g
()
i
.
next
()
try
:
1
/
0
except
:
print
"after exc:"
,
sys
.
exc_info
()[
0
]
i
.
next
()
print
"after next:"
,
sys
.
exc_info
()[
0
]
list
(
i
)
f12
()
test/tests/sys_excinfo.py
View file @
1c3f474d
# expected: fail
# - exceptions
# Different ways of nesting exceptions
import
sys
...
...
@@ -183,40 +180,6 @@ def f11():
f11
()
print
sys
.
exc_info
()[
0
]
# exc_info gets passed into generators (at both begin and send()) and cleared like normal on the way out:
def
f12
():
print
print
"f12"
print
"begin:"
,
sys
.
exc_info
()[
0
]
def
g
():
print
"start of generator:"
,
sys
.
exc_info
()[
0
]
yield
1
print
"after first yield:"
,
sys
.
exc_info
()[
0
]
try
:
raise
KeyError
()
except
:
pass
print
"after KeyError:"
,
sys
.
exc_info
()[
0
]
yield
2
try
:
raise
AttributeError
()
except
:
pass
i
=
g
()
i
.
next
()
try
:
1
/
0
except
:
print
"after exc:"
,
sys
.
exc_info
()[
0
]
i
.
next
()
print
"after next:"
,
sys
.
exc_info
()[
0
]
list
(
i
)
f12
()
# If an exception is thrown+caught in course of exception-matching, we need to still operate on the original exception:
def
f13
():
print
...
...
@@ -229,6 +192,10 @@ def f13():
print
sys
.
exc_info
()[
0
]
return
ZeroDivisionError
print
sys
.
exc_info
()[
0
]
inner
()
print
sys
.
exc_info
()[
0
]
# This applies to what goes into exc_info:
try
:
1
/
0
...
...
tools/tester.py
View file @
1c3f474d
...
...
@@ -235,7 +235,7 @@ def run_test(fn, check_stats, run_memcheck):
out_fd
,
out_fn
=
tempfile
.
mkstemp
(
prefix
=
"received_"
)
os
.
fdopen
(
exp_fd
,
'w'
).
write
(
expected_out
)
os
.
fdopen
(
out_fd
,
'w'
).
write
(
out
)
p
=
subprocess
.
Popen
([
"diff"
,
"-
u
"
,
"-a"
,
exp_fn
,
out_fn
],
stdout
=
subprocess
.
PIPE
,
preexec_fn
=
set_ulimits
)
p
=
subprocess
.
Popen
([
"diff"
,
"-
-unified=5
"
,
"-a"
,
exp_fn
,
out_fn
],
stdout
=
subprocess
.
PIPE
,
preexec_fn
=
set_ulimits
)
diff
=
p
.
stdout
.
read
()
assert
p
.
wait
()
in
(
0
,
1
)
os
.
unlink
(
exp_fn
)
...
...
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