Fix http://bugs.python.org/issue17547 for python 2.6