Skip to content

Commit d71f3e6

Browse files
committed
remove Py_GetPythonHome
1 parent 2a57840 commit d71f3e6

File tree

14 files changed

+9
-45
lines changed

14 files changed

+9
-45
lines changed

Doc/c-api/init.rst

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ The following functions can be safely called before Python is initialized:
7777

7878
Despite their apparent similarity to some of the functions listed above,
7979
the following functions **should not be called** before the interpreter has
80-
been initialized: :c:func:`Py_EncodeLocale`, :c:func:`Py_GetPythonHome`, :c:func:`PyEval_InitThreads`, and
80+
been initialized: :c:func:`Py_EncodeLocale`, :c:func:`PyEval_InitThreads`, and
8181
:c:func:`Py_RunMain`.
8282

8383

@@ -772,23 +772,6 @@ Process-wide parameters
772772
.. deprecated-removed:: 3.11 3.15
773773
774774
775-
.. c:function:: wchar_t* Py_GetPythonHome()
776-
777-
Return the default "home", that is, the value set by
778-
:c:member:`PyConfig.home`, or the value of the :envvar:`PYTHONHOME`
779-
environment variable if it is set.
780-
781-
This function should not be called before :c:func:`Py_Initialize`, otherwise
782-
it returns ``NULL``.
783-
784-
.. versionchanged:: 3.10
785-
It now returns ``NULL`` if called before :c:func:`Py_Initialize`.
786-
787-
.. deprecated-removed:: 3.13 3.15
788-
Use :c:func:`PyConfig_Get("home") <PyConfig_Get>` or the
789-
:envvar:`PYTHONHOME` environment variable instead.
790-
791-
792775
.. _threads:
793776
794777
Thread State and the Global Interpreter Lock

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 & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,6 @@ Pending removal in Python 3.15
2222
may return a type other than :class:`bytes`, such as :class:`str`.
2323
* Python initialization functions, deprecated in Python 3.13:
2424

25-
* :c:func:`Py_GetPythonHome`:
26-
Use :c:func:`PyConfig_Get("home") <PyConfig_Get>` or the
27-
:envvar:`PYTHONHOME` environment variable instead.
28-
2925
The `pythoncapi-compat project
3026
<https://github.com/python/pythoncapi-compat/>`__ can be used to get
3127
:c:func:`PyConfig_Get` on Python 3.13 and older.

Doc/whatsnew/3.10.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2177,7 +2177,7 @@ Porting to Python 3.10
21772177
(Contributed by Victor Stinner in :issue:`42157`.)
21782178
21792179
* :c:func:`!Py_GetPath`, :c:func:`!Py_GetPrefix`, :c:func:`!Py_GetExecPrefix`,
2180-
:c:func:`!Py_GetProgramFullPath`, :c:func:`Py_GetPythonHome` and
2180+
: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
21832183
:ref:`init-config` API to get the :ref:`init-path-config`.

Doc/whatsnew/3.13.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2487,7 +2487,7 @@ Deprecated C APIs
24872487
Get :data:`sys.executable` instead.
24882488
* :c:func:`!Py_GetProgramName`:
24892489
Get :data:`sys.executable` instead.
2490-
* :c:func:`Py_GetPythonHome`:
2490+
* :c:func:`!Py_GetPythonHome`:
24912491
Get :c:member:`PyConfig.home`
24922492
or the :envvar:`PYTHONHOME` environment variable instead.
24932493

Doc/whatsnew/3.15.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,3 +176,7 @@ Removed C APIs
176176
* :c:func:`!Py_GetProgramName`:
177177
use :c:func:`PyConfig_Get("executable") <PyConfig_Get>`
178178
(:data:`sys.executable`) instead.
179+
* :c:func:`!Py_GetPythonHome`:
180+
use :c:func:`PyConfig_Get("home") <PyConfig_Get>` or the
181+
:envvar:`PYTHONHOME` environment variable instead.
182+

Include/pylifecycle.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ PyAPI_FUNC(int) Py_BytesMain(int argc, char **argv);
3737
Py_DEPRECATED(3.11) PyAPI_FUNC(void) Py_SetProgramName(const wchar_t *);
3838

3939
Py_DEPRECATED(3.11) PyAPI_FUNC(void) Py_SetPythonHome(const wchar_t *);
40-
Py_DEPRECATED(3.13) PyAPI_FUNC(wchar_t *) Py_GetPythonHome(void);
4140

4241
#ifdef MS_WINDOWS
4342
int _Py_CheckPython3(void);

Lib/test/test_embed.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1708,8 +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_GetPythonHome()
1712-
#
17131711
# The global path configuration (_Py_path_config) must be a copy
17141712
# of the path configuration of PyInterpreter.config (PyConfig).
17151713
ctypes = import_helper.import_module('ctypes')
@@ -1720,12 +1718,8 @@ def get_func(name):
17201718
func.restype = ctypes.c_wchar_p
17211719
return func
17221720

1723-
Py_GetPythonHome = get_func('Py_GetPythonHome')
1724-
17251721
config = _testinternalcapi.get_configs()['config']
17261722

1727-
self.assertEqual(Py_GetPythonHome(), config['home'])
1728-
17291723
def test_init_warnoptions(self):
17301724
# lowest to highest priority
17311725
warnoptions = [

Lib/test/test_stable_abi_ctypes.py

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

Misc/NEWS.d/3.10.0a3.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1396,7 +1396,7 @@ but now can get the condition by calling the new private
13961396
.. section: C API
13971397
13981398
:c:func:`!Py_GetPath`, :c:func:`!Py_GetPrefix`, :c:func:`!Py_GetExecPrefix`,
1399-
:c:func:`!Py_GetProgramFullPath`, :c:func:`Py_GetPythonHome` and
1399+
:c:func:`!Py_GetProgramFullPath`, :c:func:`!Py_GetPythonHome` and
14001400
:c:func:`!Py_GetProgramName` functions now return ``NULL`` if called before
14011401
:c:func:`Py_Initialize` (before Python is initialized). Use the new
14021402
:ref:`Python Initialization Configuration API <init-config>` to get the

0 commit comments

Comments
 (0)