Merge pull request #209 from therefromhere/pythonoptimize_fix

Support for PYTHONOPTIMIZE=2, fix tests on PYTHONOPTIMIZE=1, 2