fix tests/crash on python 3
Merge pull request #1415 from nouiz/py3

fix tests/crash on python 3