Skip to content

Commit 4e74756

Browse files
committed
remove Py_GetExecPrefix
1 parent 05a7da4 commit 4e74756

File tree

16 files changed

+12
-81
lines changed

16 files changed

+12
-81
lines changed

Doc/c-api/init.rst

Lines changed: 1 addition & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,7 @@ The following functions can be safely called before Python is initialized:
7878
Despite their apparent similarity to some of the functions listed above,
7979
the following functions **should not be called** before the interpreter has
8080
been initialized: :c:func:`Py_EncodeLocale`, :c:func:`Py_GetPath`,
81-
:c:func:`Py_GetPrefix`, :c:func:`Py_GetExecPrefix`,
82-
:c:func:`Py_GetProgramFullPath`, :c:func:`Py_GetPythonHome`, :c:func:`PyEval_InitThreads`, and
81+
:c:func:`Py_GetPrefix`, :c:func:`Py_GetProgramFullPath`, :c:func:`Py_GetPythonHome`, :c:func:`PyEval_InitThreads`, and
8382
:c:func:`Py_RunMain`.
8483

8584

@@ -633,54 +632,6 @@ Process-wide parameters
633632
<venv-def>` need to be handled.
634633
635634
636-
.. c:function:: wchar_t* Py_GetExecPrefix()
637-
638-
Return the *exec-prefix* for installed platform-*dependent* files. This is
639-
derived through a number of complicated rules from the program name set with
640-
:c:member:`PyConfig.program_name` and some environment variables; for example, if the
641-
program name is ``'/usr/local/bin/python'``, the exec-prefix is
642-
``'/usr/local'``. The returned string points into static storage; the caller
643-
should not modify its value. This corresponds to the :makevar:`exec_prefix`
644-
variable in the top-level :file:`Makefile` and the ``--exec-prefix``
645-
argument to the :program:`configure` script at build time. The value is
646-
available to Python code as ``sys.base_exec_prefix``. It is only useful on
647-
Unix.
648-
649-
Background: The exec-prefix differs from the prefix when platform dependent
650-
files (such as executables and shared libraries) are installed in a different
651-
directory tree. In a typical installation, platform dependent files may be
652-
installed in the :file:`/usr/local/plat` subtree while platform independent may
653-
be installed in :file:`/usr/local`.
654-
655-
Generally speaking, a platform is a combination of hardware and software
656-
families, e.g. Sparc machines running the Solaris 2.x operating system are
657-
considered the same platform, but Intel machines running Solaris 2.x are another
658-
platform, and Intel machines running Linux are yet another platform. Different
659-
major revisions of the same operating system generally also form different
660-
platforms. Non-Unix operating systems are a different story; the installation
661-
strategies on those systems are so different that the prefix and exec-prefix are
662-
meaningless, and set to the empty string. Note that compiled Python bytecode
663-
files are platform independent (but not independent from the Python version by
664-
which they were compiled!).
665-
666-
System administrators will know how to configure the :program:`mount` or
667-
:program:`automount` programs to share :file:`/usr/local` between platforms
668-
while having :file:`/usr/local/plat` be a different filesystem for each
669-
platform.
670-
671-
This function should not be called before :c:func:`Py_Initialize`, otherwise
672-
it returns ``NULL``.
673-
674-
.. versionchanged:: 3.10
675-
It now returns ``NULL`` if called before :c:func:`Py_Initialize`.
676-
677-
.. deprecated-removed:: 3.13 3.15
678-
Use :c:func:`PyConfig_Get("base_exec_prefix") <PyConfig_Get>`
679-
(:data:`sys.base_exec_prefix`) instead. Use
680-
:c:func:`PyConfig_Get("exec_prefix") <PyConfig_Get>`
681-
(:data:`sys.exec_prefix`) if :ref:`virtual environments <venv-def>` need
682-
to be handled.
683-
684635
.. c:function:: wchar_t* Py_GetProgramFullPath()
685636
686637
.. index::

Doc/c-api/intro.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -782,7 +782,6 @@ front of the standard path by setting :envvar:`PYTHONPATH`.
782782
.. index::
783783
single: Py_GetPath (C function)
784784
single: Py_GetPrefix (C function)
785-
single: Py_GetExecPrefix (C function)
786785
single: Py_GetProgramFullPath (C function)
787786

788787
The embedding application can steer the search by setting
@@ -791,7 +790,7 @@ The embedding application can steer the search by setting
791790
:envvar:`PYTHONHOME` still overrides this and :envvar:`PYTHONPATH` is still
792791
inserted in front of the standard path. An application that requires total
793792
control has to provide its own implementation of :c:func:`Py_GetPath`,
794-
:c:func:`Py_GetPrefix`, :c:func:`Py_GetExecPrefix`, and
793+
:c:func:`Py_GetPrefix`, and
795794
:c:func:`Py_GetProgramFullPath` (all defined in :file:`Modules/getpath.c`).
796795

797796
.. index:: single: Py_IsInitialized (C function)

Doc/data/refcounts.dat

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3007,8 +3007,6 @@ Py_GetCompiler:const char*:::
30073007

30083008
Py_GetCopyright:const char*:::
30093009

3010-
Py_GetExecPrefix:wchar_t*:::
3011-
30123010
Py_GetPath:wchar_t*:::
30133011

30143012
Py_GetPlatform:const char*:::

Doc/data/stable_abi.dat

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

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

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,6 @@ Pending removal in Python 3.15
3030
(:data:`sys.base_prefix`) instead. Use :c:func:`PyConfig_Get("prefix")
3131
<PyConfig_Get>` (:data:`sys.prefix`) if :ref:`virtual environments
3232
<venv-def>` need to be handled.
33-
* :c:func:`Py_GetExecPrefix`:
34-
Use :c:func:`PyConfig_Get("base_exec_prefix") <PyConfig_Get>`
35-
(:data:`sys.base_exec_prefix`) instead. Use
36-
:c:func:`PyConfig_Get("exec_prefix") <PyConfig_Get>`
37-
(:data:`sys.exec_prefix`) if :ref:`virtual environments <venv-def>` need to
38-
be handled.
3933
* :c:func:`Py_GetProgramFullPath`:
4034
Use :c:func:`PyConfig_Get("executable") <PyConfig_Get>`
4135
(:data:`sys.executable`) instead.

Doc/whatsnew/3.10.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2176,7 +2176,7 @@ Porting to Python 3.10
21762176
``unicodedata.ucnhash_CAPI`` has been moved to the internal C API.
21772177
(Contributed by Victor Stinner in :issue:`42157`.)
21782178
2179-
* :c:func:`Py_GetPath`, :c:func:`Py_GetPrefix`, :c:func:`Py_GetExecPrefix`,
2179+
* :c:func:`Py_GetPath`, :c:func:`Py_GetPrefix`, :c:func:`!Py_GetExecPrefix`,
21802180
:c:func:`Py_GetProgramFullPath`, :c:func:`Py_GetPythonHome` and
21812181
:c:func:`!Py_GetProgramName` functions now return ``NULL`` if called before
21822182
:c:func:`Py_Initialize` (before Python is initialized). Use the new

Doc/whatsnew/3.13.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2477,7 +2477,7 @@ Deprecated C APIs
24772477

24782478
* :c:func:`PySys_ResetWarnOptions`:
24792479
Clear :data:`sys.warnoptions` and :data:`!warnings.filters` instead.
2480-
* :c:func:`Py_GetExecPrefix`:
2480+
* :c:func:`!Py_GetExecPrefix`:
24812481
Get :data:`sys.exec_prefix` instead.
24822482
* :c:func:`Py_GetPath`:
24832483
Get :data:`sys.path` instead.

Doc/whatsnew/3.15.rst

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,12 @@ Deprecated C APIs
155155
Removed C APIs
156156
--------------
157157

158+
* :c:func:`!Py_GetExecPrefix`:
159+
use :c:func:`PyConfig_Get("base_exec_prefix") <PyConfig_Get>`
160+
(:data:`sys.base_exec_prefix`) instead.
161+
Use :c:func:`PyConfig_Get("exec_prefix") <PyConfig_Get>`
162+
(:data:`sys.exec_prefix`) if :ref:`virtual environments <venv-def>`
163+
need to be handled.
158164
* :c:func:`!Py_GetProgramName`:
159165
use :c:func:`PyConfig_Get("executable") <PyConfig_Get>`
160166
(:data:`sys.executable`) instead.
161-

Include/pylifecycle.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ Py_DEPRECATED(3.13) PyAPI_FUNC(wchar_t *) Py_GetPythonHome(void);
4141

4242
Py_DEPRECATED(3.13) PyAPI_FUNC(wchar_t *) Py_GetProgramFullPath(void);
4343
Py_DEPRECATED(3.13) PyAPI_FUNC(wchar_t *) Py_GetPrefix(void);
44-
Py_DEPRECATED(3.13) PyAPI_FUNC(wchar_t *) Py_GetExecPrefix(void);
4544
Py_DEPRECATED(3.13) PyAPI_FUNC(wchar_t *) Py_GetPath(void);
4645
#ifdef MS_WINDOWS
4746
int _Py_CheckPython3(void);

Lib/test/test_embed.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1708,7 +1708,6 @@ def test_getpath_abspath_win32(self):
17081708
def test_global_pathconfig(self):
17091709
# Test C API functions getting the path configuration:
17101710
#
1711-
# - Py_GetExecPrefix()
17121711
# - Py_GetPath()
17131712
# - Py_GetPrefix()
17141713
# - Py_GetProgramFullPath()
@@ -1726,7 +1725,6 @@ def get_func(name):
17261725

17271726
Py_GetPath = get_func('Py_GetPath')
17281727
Py_GetPrefix = get_func('Py_GetPrefix')
1729-
Py_GetExecPrefix = get_func('Py_GetExecPrefix')
17301728
Py_GetProgramFullPath = get_func('Py_GetProgramFullPath')
17311729
Py_GetPythonHome = get_func('Py_GetPythonHome')
17321730

@@ -1735,7 +1733,6 @@ def get_func(name):
17351733
self.assertEqual(tuple(Py_GetPath().split(os.path.pathsep)),
17361734
config['module_search_paths'])
17371735
self.assertEqual(Py_GetPrefix(), config['prefix'])
1738-
self.assertEqual(Py_GetExecPrefix(), config['exec_prefix'])
17391736
self.assertEqual(Py_GetProgramFullPath(), config['executable'])
17401737
self.assertEqual(Py_GetPythonHome(), config['home'])
17411738

0 commit comments

Comments
 (0)