Fix compilation for python3.

Thanks to Atri Bhattacharya for reporting the problem.