Fix #127, add a work-around for CPython bug 20007.

The bug has been fixed upstream, but this works around it on older Python versions. This does not change any behavior on Python versions with the fix.