Skip to content

Deprecation of Py_GetPrefix-family APIs should document the sys.base_* counterparts #125313

Closed
@y5c4l3

Description

@y5c4l3

Documentation

Documentation suggests sys.prefix as an alternative to Py_GetPrefix in the deprecation note here

Deprecated since version 3.13, will be removed in version 3.15: Get sys.prefix instead.

and it seems correct:

>>> import poc # CPython module that prints `Py_GetPrefix` on init
Prefix: /home/y5/micromamba/envs/py3.13
>>> import sys; print(sys.prefix); print(sys.base_prefix)
/home/y5/micromamba/envs/py3.13
/home/y5/micromamba/envs/py3.13

But strictly speaking, sys.base_prefix is the real counterpart rather than sys.prefix when it involves venv:

# inside venv
>>> import poc
Prefix: /home/y5/micromamba/envs/py3.13
>>> import sys; print(sys.prefix); print(sys.base_prefix)
/tmp/foo
/home/y5/micromamba/envs/py3.13

Source: #125235

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    docsDocumentation in the Doc dir

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions