[issue37089] `import Lib.os` works on windows (but shouldn't)

Steve Dower report at bugs.python.org
Wed Jun 5 12:35:23 EDT 2019


Steve Dower <steve.dower at python.org> added the comment:

There are certainly people relying on sys.prefix being in sys.path (for .pth files and embedding), but probably not so many that we couldn't remove it in a major release. It is a bit strange in a venv, where there's typically nothing in the root of the environment (when we discovered this, we decided we could stop copying all the modules over, as they weren't being used anyway).

I think in every supported distribution we make though, there's no need for it. But we'd probably have to just remove it and see what breaks - most of the people relying on it probably have no idea, but they're also probably bundling it in some way that makes it easy to detect and fix.

All that said, I'm not particularly offended by this. It's namespace packages working as intended, and since it seems to be a highly complex interaction of configuration settings to get sys.prefix on sys.path in a variety of circumstances (we're not relying on registry settings here any more) I'd want to see changes and tests before assuming we can do it without regressing real scenarios.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue37089>
_______________________________________


More information about the Python-bugs-list mailing list