This bug seems to have been caused by
https://salsa.debian.org/cpython-team/python3-defaults/-/commit/8e243207fee371a7335674fc77db63044b62cb29

It migrated from imp to importlib, but importlib doesn't imply
importlib.util -- you cannot and AFAIK never have been able to import
the top-level package and assume the nested modules are available.

That being said, it did work for me in my (non-Debian :P) 3.11
environment, purely because I had a .pth file that caused importlib.util
to be imported at startup. (It is the stock setuptools one for namespace
packages. You can isolate the interpreter a bit with -IS to catch this.)

So a similar problem may explain why this wasn't caught during local
testing. It probably makes sense to generally test this sort of thing
with minimal packages installed, because sneaky .pth files will cause
you issues all the time.

Reply via email to