py: Add more compiler optimisations for constant if/while conditions.