Workaround for Python bug 7980