Be more careful with python 3 exception compatibility - use Cython's exception utility code