Fix Python 3 compatibility (broken by f5df6695c04305cfa04a393ad863e334bf6c57ae).