Fixed upstream in Python3.11 via https://github.com/python/cpython/issues/89596
Backport here to Python3.10 so libpython doesn't have a needless system
dependency on libcrypt (which is different on Linux between RH-based and
Debian-based distros too).