Workaround for http://bugs.python.org/issue2128