summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorPaul Sokolovsky <pfalcon@users.sourceforge.net>2014-03-30 13:18:22 +0300
committerPaul Sokolovsky <pfalcon@users.sourceforge.net>2014-03-30 13:21:11 +0300
commitee5ecc9de2484188af861bf9b5a4ff925d5bb866 (patch)
tree6c46f800835558ad1464a6cd034907cf8dbe8890
parent9a54a223188840caf5b98fb618c40ae5056b48c2 (diff)
downloadmicropython-ee5ecc9de2484188af861bf9b5a4ff925d5bb866.tar.gz
micropython-ee5ecc9de2484188af861bf9b5a4ff925d5bb866.zip
objgenerator.throw: Instantiate if exception type passed, just as "raise".
Caught by CPython test_pep380.py.
-rw-r--r--py/objgenerator.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/py/objgenerator.c b/py/objgenerator.c
index e161720605..1c81b2e51a 100644
--- a/py/objgenerator.c
+++ b/py/objgenerator.c
@@ -162,6 +162,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(gen_instance_send_obj, gen_instance_send);
STATIC mp_obj_t gen_instance_close(mp_obj_t self_in);
STATIC mp_obj_t gen_instance_throw(uint n_args, const mp_obj_t *args) {
mp_obj_t exc = (n_args == 2) ? args[1] : args[2];
+ exc = rt_make_raise_obj(exc);
if (mp_obj_is_subclass_fast(mp_obj_get_type(exc), &mp_type_GeneratorExit)) {
// Throwing GeneratorExit is equivalent of calling close aka
// GeneratorExit should be handled specially