Follow up from a similar fix in 426785a19eeb12aef7383fbda4693575d8c4dddf Fixes issue #6314. Signed-off-by: Damien George <damien@micropython.org>
Fixes issue #7782, and part of issue #6314. Signed-off-by: Damien George <damien@micropython.org>