Fix buffer overflow stuff for Python 3