summaryrefslogtreecommitdiff
path: root/py/objnamedtuple.c
diff options
context:
space:
mode:
authorDamien George <damien@micropython.org>2022-06-21 18:11:19 +1000
committerDamien George <damien@micropython.org>2022-07-12 18:17:44 +1000
commitd84220b8c62003b4714e0fa514a46ff5139148dc (patch)
tree45a8fd995ec210c98f84144db2138e2a65b7a9fd /py/objnamedtuple.c
parent093c4b6b2681951a277c71453598a9e0e2a82f52 (diff)
py/vm: Remove check for ip being NULL when handling StopIteration.
This check for code_state->ip being NULL was added in a7c02c4538bb2b986efb1999e00da4d76345767d with a commit message that "When generator raises exception, it is automatically terminated (by setting its code_state.ip to 0)". It was also added without any tests to test for this particular case. (The commit did mention that CPython's test_pep380.py triggered a bug, but upon re-running this test it did not show any need for this NULL check of code_state->ip.) It is true that generators that have completed (either by running to their end or raising an exception) set "code_state.ip = 0". But there is an explicit check at the start of mp_obj_gen_resume() to return immediately for any attempt to resume an already-stopped generator. So the VM can never execute a generator with NULL ip (and this was true at the time of the above-referenced commit). Furthermore, the other parts of the VM just before and after this piece of code do require (or at least assume) code_state->ip is non-NULL. Signed-off-by: Damien George <damien@micropython.org>
Diffstat (limited to 'py/objnamedtuple.c')
0 files changed, 0 insertions, 0 deletions