Skip to content

Commit 7711a1c

Browse files
[3.13] gh-125313: Prefer sys.base_* paths in Py_Get(Exec)Prefix deprecation notes (GH-125317) (#125776)
gh-125313: Prefer `sys.base_*` paths in `Py_Get(Exec)Prefix` deprecation notes (GH-125317) Prefer `sys.base_*` paths in `Py_Get(Exec)Prefix` deprecation notes. (cherry picked from commit 7d88140) Signed-off-by: y5c4l3 <[email protected]> Co-authored-by: Y5 <[email protected]>
1 parent 483c747 commit 7711a1c

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

Doc/c-api/init.rst

+7-4
Original file line numberDiff line numberDiff line change
@@ -615,7 +615,7 @@ Process-wide parameters
615615
returned string points into static storage; the caller should not modify its
616616
value. This corresponds to the :makevar:`prefix` variable in the top-level
617617
:file:`Makefile` and the :option:`--prefix` argument to the :program:`configure`
618-
script at build time. The value is available to Python code as ``sys.prefix``.
618+
script at build time. The value is available to Python code as ``sys.base_prefix``.
619619
It is only useful on Unix. See also the next function.
620620
621621
This function should not be called before :c:func:`Py_Initialize`, otherwise
@@ -625,7 +625,8 @@ Process-wide parameters
625625
It now returns ``NULL`` if called before :c:func:`Py_Initialize`.
626626
627627
.. deprecated-removed:: 3.13 3.15
628-
Get :data:`sys.prefix` instead.
628+
Get :data:`sys.base_prefix` instead, or :data:`sys.prefix` if
629+
:ref:`virtual environments <venv-def>` need to be handled.
629630
630631
631632
.. c:function:: wchar_t* Py_GetExecPrefix()
@@ -638,7 +639,8 @@ Process-wide parameters
638639
should not modify its value. This corresponds to the :makevar:`exec_prefix`
639640
variable in the top-level :file:`Makefile` and the ``--exec-prefix``
640641
argument to the :program:`configure` script at build time. The value is
641-
available to Python code as ``sys.exec_prefix``. It is only useful on Unix.
642+
available to Python code as ``sys.base_exec_prefix``. It is only useful on
643+
Unix.
642644
643645
Background: The exec-prefix differs from the prefix when platform dependent
644646
files (such as executables and shared libraries) are installed in a different
@@ -669,7 +671,8 @@ Process-wide parameters
669671
It now returns ``NULL`` if called before :c:func:`Py_Initialize`.
670672
671673
.. deprecated-removed:: 3.13 3.15
672-
Get :data:`sys.exec_prefix` instead.
674+
Get :data:`sys.base_exec_prefix` instead, or :data:`sys.exec_prefix` if
675+
:ref:`virtual environments <venv-def>` need to be handled.
673676
674677
675678
.. c:function:: wchar_t* Py_GetProgramFullPath()

Doc/deprecations/c-api-pending-removal-in-3.15.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ Pending Removal in Python 3.15
1313
* :c:func:`PySys_ResetWarnOptions`:
1414
Clear :data:`sys.warnoptions` and :data:`!warnings.filters` instead.
1515
* :c:func:`Py_GetExecPrefix`:
16-
Get :data:`sys.exec_prefix` instead.
16+
Get :data:`sys.base_exec_prefix` and :data:`sys.exec_prefix` instead.
1717
* :c:func:`Py_GetPath`:
1818
Get :data:`sys.path` instead.
1919
* :c:func:`Py_GetPrefix`:
20-
Get :data:`sys.prefix` instead.
20+
Get :data:`sys.base_prefix` and :data:`sys.prefix` instead.
2121
* :c:func:`Py_GetProgramFullPath`:
2222
Get :data:`sys.executable` instead.
2323
* :c:func:`Py_GetProgramName`:

0 commit comments

Comments
 (0)