Fixes for compatibility with PyPy 2.3.

For some reason, PyPy returns strange results from methods invoked via
CTypes. The tests don't pass when using PyPy, but it didn't pass with
Python 2.7 either.