Further attempts to fix Python 3 compilation errors