Fix segfault on Python 2.