Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

sysconfig data inconsistencies caused by the disabling thesite initialization on virtual environments #126789

Closed
Labels
@FFY00

Description

@FFY00

Bug report

Bug description:

Currently, running the Python interpreter with-S (disabling thesite module initialization) causes several inconsistenciessysconfig.get_paths() depends on whethersysconfig was imported before or after thesite initialization

Currently,sysconfig calculates the paths at import time and caches them. This results in it resulting incorrect paths if thesite initialization happens aftersysconfig was imported.

$python-SPython3.14.0a1+experimentalfree-threadingbuild (heads/main:de0d5c6e2e1,Oct232024,15:37:46) [GCC14.2.120240910]onlinux>>>importsysconfig>>>sysconfig.get_paths(){'stdlib':'/usr/local/lib/python3.14t','platstdlib':'/usr/local/lib/python3.14t','purelib':'/usr/local/lib/python3.14t/site-packages','platlib':'/usr/local/lib/python3.14t/site-packages','include':'/usr/local/include/python3.14td','platinclude':'/usr/local/include/python3.14td','scripts':'/usr/local/bin','data':'/usr/local'}>>>importsite>>>site.main()>>>sysconfig.get_paths(){'stdlib':'/usr/local/lib/python3.14t','platstdlib':'/usr/local/lib/python3.14t','purelib':'/usr/local/lib/python3.14t/site-packages','platlib':'/usr/local/lib/python3.14t/site-packages','include':'/usr/local/include/python3.14td','platinclude':'/usr/local/include/python3.14td','scripts':'/usr/local/bin','data':'/usr/local'}

Expected output when thesite module has been initialized:

$pythonPython3.14.0a1+experimentalfree-threadingbuild (heads/main:de0d5c6e2e1,Oct232024,15:37:46) [GCC14.2.120240910]onlinuxType"help","copyright","credits"or"license"formoreinformation.>>>importsysconfig>>>sysconfig.get_paths(){'stdlib':'/usr/local/lib/python3.14t','platstdlib':'/home/anubis/.virtualenvs/test-sysconfig-paths/lib/python3.14t','purelib':'/home/anubis/.virtualenvs/test-sysconfig-paths/lib/python3.14t/site-packages','platlib':'/home/anubis/.virtualenvs/test-sysconfig-paths/lib/python3.14t/site-packages','include':'/usr/local/include/python3.14td','platinclude':'/usr/local/include/python3.14td','scripts':'/home/anubis/.virtualenvs/test-sysconfig-paths/bin','data':'/home/anubis/.virtualenvs/test-sysconfig-paths'}

And just to make sure this is not dependent on the interpreter being run with-S, and rather on thesysconfig import time.

$python-SPython3.14.0a1+experimentalfree-threadingbuild (heads/main:de0d5c6e2e1,Oct232024,15:37:46) [GCC14.2.120240910]onlinux>>>importsite>>>site.main()>>>importsysconfig>>>sysconfig.get_paths(){'stdlib':'/usr/local/lib/python3.14t','platstdlib':'/home/anubis/.virtualenvs/test-sysconfig-paths/lib/python3.14t','purelib':'/home/anubis/.virtualenvs/test-sysconfig-paths/lib/python3.14t/site-packages','platlib':'/home/anubis/.virtualenvs/test-sysconfig-paths/lib/python3.14t/site-packages','include':'/usr/local/include/python3.14td','platinclude':'/usr/local/include/python3.14td','scripts':'/home/anubis/.virtualenvs/test-sysconfig-paths/bin','data':'/home/anubis/.virtualenvs/test-sysconfig-paths'}

CPython versions tested on:

3.9, 3.10, 3.11, 3.12, 3.13, 3.14

Operating systems tested on:

Linux

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp