Skip to content

site.py hardcodes "python" instead of using {implementation_lower} #138614

@ShaharNaveh

Description

@ShaharNaveh

Feature or enhancement

Proposal:

Currently in

return f'{userbase}/lib/python{version[0]}.{version[1]}{abi_thread}/site-packages'

the string "python" is hardcoded.

This creates issues for alternative Python implementations (e.g. PyPy, RustPython, etc.), which often rely on sys.implementation.name to determine the correct directory layout. By hardcoding "python", the code assumes CPython specifically, making it less portable.

Proposed change:

Change the offending line to use the {implementation_lower} instead as it is already used throughout the function

Has this already been discussed elsewhere?

No

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    stdlibStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions