backport patch from https://github.com/python/cpython/pull/17730 PR
backport patch from https://github.com/python/cpython/pull/17730 PR

Signed-off-by: Oleg Höfling <5372a8938f37931bff856e791e71bfdb147a99f0@gmail.com>

python/importlib_metadata