python / python/cpython

sysconfig values for `platstdlib` do not appear to be accurate

Open
#119,845 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

stdlib topic-sysconfig topic-venv type-bug
Dominant language
Python
Stars
77.2k
Forks
35.9k
PR merge metrics
PR metrics pending

Description

Bug report

Bug description:

The values set for platstdlib in the sysconfig scheme paths are not consistent with the way sys.path is configured in getpath.py

sysconfig: https://github.com/python/cpython/blob/main/Lib/sysconfig/__init__.py#L28
getpath: https://github.com/python/cpython/blob/main/Modules/getpath.py#L182

Given this appears to have been wrong essentially forever, it appears nobody is using platstdlib for anything important (even I only noticed because running -m sysconfig inside a venv reports a platstdlib path inside the venv, which is definitely not right).

Still, it should be possible to make them at least a bit more consistent with the way sys.path is actually initialised (appending lib-dynload to the stdlib path looks to be sufficient for non-Windows system, but I'm less sure on Windows)

CPython versions tested on:

3.12

Operating systems tested on:

Linux, 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

Compare Lib/sysconfig/init.py#L28 with Modules/getpath.py#L182, starting with how platstdlib is formed on Linux and Windows. Verify the resulting paths against sys.path and python -m sysconfig in and outside a virtual environment; done means platstdlib reflects actual initialization on both platforms.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
operating-systems
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.