py: Fix stack underflow with optimised for loop.