diff options
| author | Kenny <3454741+WarriorOfWire@users.noreply.github.com> | 2020-10-10 23:39:32 -0700 |
|---|---|---|
| committer | Kenny <3454741+WarriorOfWire@users.noreply.github.com> | 2020-10-10 23:39:32 -0700 |
| commit | 98aa4b794346161e512d0fba913901021dd2cfbf (patch) | |
| tree | 8a6dfa086f6ac86d2a2852c7121a3636814a74f7 /py/objgenerator.c | |
| parent | 5d96afc5c2e4b4b6aa265a96a3921ac71f036980 (diff) | |
update async tests with less upython workaround and more cpython compatibility
Diffstat (limited to 'py/objgenerator.c')
| -rw-r--r-- | py/objgenerator.c | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/py/objgenerator.c b/py/objgenerator.c index baa6a9849..5e651ac26 100644 --- a/py/objgenerator.c +++ b/py/objgenerator.c @@ -234,12 +234,8 @@ STATIC mp_obj_t gen_instance_await(mp_obj_t self_in) { nlr_raise(mp_obj_new_exception_msg_varg(&mp_type_AttributeError, translate("type object 'generator' has no attribute '__await__'"))); } - mp_obj_t ret = gen_resume_and_raise(self_in, mp_const_none, MP_OBJ_NULL); - if (ret == MP_OBJ_STOP_ITERATION) { - nlr_raise(mp_obj_new_exception(&mp_type_StopIteration)); - } else { - return ret; - } + // You can directly call send on a coroutine generator or you can __await__ then send on the return of that. + return self; } STATIC MP_DEFINE_CONST_FUN_OBJ_1(gen_instance_await_obj, gen_instance_await); #endif |
