Skip to content

Commit 7d88140

Browse files
authored
gh-125313: Prefer sys.base_* paths in Py_Get(Exec)Prefix deprecation notes (#125317)
Prefer `sys.base_*` paths in `Py_Get(Exec)Prefix` deprecation notes. Signed-off-by: y5c4l3 <[email protected]>
1 parent ded105a commit 7d88140

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

Doc/c-api/init.rst

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -625,7 +625,7 @@ Process-wide parameters
625625
returned string points into static storage; the caller should not modify its
626626
value. This corresponds to the :makevar:`prefix` variable in the top-level
627627
:file:`Makefile` and the :option:`--prefix` argument to the :program:`configure`
628-
script at build time. The value is available to Python code as ``sys.prefix``.
628+
script at build time. The value is available to Python code as ``sys.base_prefix``.
629629
It is only useful on Unix. See also the next function.
630630
631631
This function should not be called before :c:func:`Py_Initialize`, otherwise
@@ -635,7 +635,8 @@ Process-wide parameters
635635
It now returns ``NULL`` if called before :c:func:`Py_Initialize`.
636636
637637
.. deprecated-removed:: 3.13 3.15
638-
Get :data:`sys.prefix` instead.
638+
Get :data:`sys.base_prefix` instead, or :data:`sys.prefix` if
639+
:ref:`virtual environments <venv-def>` need to be handled.
639640
640641
641642
.. c:function:: wchar_t* Py_GetExecPrefix()
@@ -648,7 +649,8 @@ Process-wide parameters
648649
should not modify its value. This corresponds to the :makevar:`exec_prefix`
649650
variable in the top-level :file:`Makefile` and the ``--exec-prefix``
650651
argument to the :program:`configure` script at build time. The value is
651-
available to Python code as ``sys.exec_prefix``. It is only useful on Unix.
652+
available to Python code as ``sys.base_exec_prefix``. It is only useful on
653+
Unix.
652654
653655
Background: The exec-prefix differs from the prefix when platform dependent
654656
files (such as executables and shared libraries) are installed in a different
@@ -679,7 +681,8 @@ Process-wide parameters
679681
It now returns ``NULL`` if called before :c:func:`Py_Initialize`.
680682
681683
.. deprecated-removed:: 3.13 3.15
682-
Get :data:`sys.exec_prefix` instead.
684+
Get :data:`sys.base_exec_prefix` instead, or :data:`sys.exec_prefix` if
685+
:ref:`virtual environments <venv-def>` need to be handled.
683686
684687
685688
.. c:function:: wchar_t* Py_GetProgramFullPath()

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

Lines changed: 2 additions & 2 deletions
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)