Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
uPython-mirror
Commits
c403076e
Commit
c403076e
authored
Mar 26, 2014
by
Paul Sokolovsky
Browse files
vm: Implement raise statement w/o args (reraising last exception).
parent
38f0c607
Changes
2
Hide whitespace changes
Inline
Side-by-side
py/vm.c
View file @
c403076e
...
...
@@ -604,8 +604,14 @@ unwind_return:
case
MP_BC_RAISE_VARARGS
:
unum
=
*
ip
++
;
assert
(
unum
==
1
);
obj1
=
POP
();
assert
(
unum
<=
1
);
if
(
unum
==
0
)
{
// This assumes that nlr.ret_val holds last raised
// exception and is not overwritten since then.
obj1
=
nlr
.
ret_val
;
}
else
{
obj1
=
POP
();
}
nlr_jump
(
rt_make_raise_obj
(
obj1
));
case
MP_BC_YIELD_VALUE
:
...
...
tests/basics/try-reraise.py
0 → 100644
View file @
c403076e
# Re-reraising last exception with raise w/o args
def
f
():
try
:
raise
ValueError
(
"val"
,
3
)
except
:
raise
try
:
f
()
except
ValueError
as
e
:
print
(
repr
(
e
))
Write
Preview
Supports
Markdown
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