diff options
| author | Damien George <damien.p.george@gmail.com> | 2018-07-10 16:21:34 +1000 |
|---|---|---|
| committer | Damien George <damien.p.george@gmail.com> | 2018-07-10 16:33:57 +1000 |
| commit | e2e22e3d7e29985579b2c91c639c71229422f349 (patch) | |
| tree | c9606c2ac7241209e6620c849a76b97ff39f3dc2 /py/objgenerator.c | |
| parent | ee40d1704fc3ec285f0be67ef7010670a1c5c01a (diff) | |
py/objgenerator: Implement __name__ with normal fun attr accessor code.
With the recent change b488a4a8480533a6a3c9468c2f8bd359c94d4d02, a
generating function now has the same layout in memory as a normal bytecode
function, and so can reuse the latter's attribute accessor code to
implement __name__.
Diffstat (limited to 'py/objgenerator.c')
| -rw-r--r-- | py/objgenerator.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/py/objgenerator.c b/py/objgenerator.c index 8b898c937..c45bebacd 100644 --- a/py/objgenerator.c +++ b/py/objgenerator.c @@ -68,6 +68,9 @@ const mp_obj_type_t mp_type_gen_wrap = { .name = MP_QSTR_generator, .call = gen_wrap_call, .unary_op = mp_generic_unary_op, + #if MICROPY_PY_FUNCTION_ATTRS + .attr = mp_obj_fun_bc_attr, + #endif }; /******************************************************************************/ |
