tests: Disable print_exception test when using native emitter.
py: Fix a semantic issue with range optimisation.

Now you can assign to the range variable within the for loop and it will
still work.

Partially addresses issue #565.