Fixed test failure from Python 3 raising a different exception. Attempt to fix C-ext compilation error in Python 3.