python / python/cpython

Python 3.11 and above adding default module search path from the “PythonPath” registry key if the standard library was found already

Open
#119,920 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

OS-windows type-bug
Dominant language
Python
Stars
77.2k
Forks
35.9k
PR merge metrics
PR metrics pending

Description

Bug report

Bug description:

Please see https://discuss.python.org/t/behaviour-change-in-python-3-11-compatibility-break-or-genuine-fix/54729

There's also another issue highlited in the same module by the author, but it's not important as we can workaround by setting PYTHONNOUSERSITE as seen below.

"Including import site inadvertently enables the user site packages directory because the configuration with a ._pth file doesn’t explicitly disable it. I think it should because I can’t imagine why an embedding application would ever want that. You’ll have to set PYTHONNOUSERSITE to work around this."

CPython versions tested on:

3.10, 3.11, 3.12

Operating systems tested on:

Windows

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked Python discussion and reproduce the behavior on Windows using CPython 3.10, 3.11, and 3.12. Trace how the PythonPath registry key contributes to the default module search path after the standard library is found; done means the intended behavior and any required regression coverage are established.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.