Skip to content

Commit e7de63c

Browse files
committed
Remove PySys_GetObject()
1 parent c102f8d commit e7de63c

File tree

2 files changed

+38
-39
lines changed

2 files changed

+38
-39
lines changed

Doc/c-api/init.rst

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -622,8 +622,8 @@ Process-wide parameters
622622
It now returns ``NULL`` if called before :c:func:`Py_Initialize`.
623623
624624
.. deprecated-removed:: 3.13 3.15
625-
Use ``PySys_GetObject("executable")`` (:data:`sys.executable`) or
626-
``PyConfig_Get("executable")`` instead.
625+
Use :c:func:`PyConfig_Get("executable") <PyConfig_Get>`
626+
(:data:`sys.executable`) instead.
627627
628628
629629
.. c:function:: wchar_t* Py_GetPrefix()
@@ -645,11 +645,10 @@ Process-wide parameters
645645
It now returns ``NULL`` if called before :c:func:`Py_Initialize`.
646646
647647
.. deprecated-removed:: 3.13 3.15
648-
Use ``PySys_GetObject("base_prefix")`` (:data:`sys.base_prefix`) or
649-
``PyConfig_Get("base_prefix")`` instead. Use
650-
``PySys_GetObject("prefix")`` (:data:`sys.prefix`) or
651-
``PyConfig_Get("prefix")`` if :ref:`virtual environments <venv-def>` need
652-
to be handled.
648+
Use :c:func:`PyConfig_Get("base_prefix") <PyConfig_Get>`
649+
(:data:`sys.base_prefix`) instead. Use :c:func:`PyConfig_Get("prefix")
650+
<PyConfig_Get>` (:data:`sys.prefix`) if :ref:`virtual environments
651+
<venv-def>` need to be handled.
653652
654653
655654
.. c:function:: wchar_t* Py_GetExecPrefix()
@@ -694,12 +693,11 @@ Process-wide parameters
694693
It now returns ``NULL`` if called before :c:func:`Py_Initialize`.
695694

696695
.. deprecated-removed:: 3.13 3.15
697-
Use ``PySys_GetObject("base_exec_prefix")``
698-
(:data:`sys.base_exec_prefix`) or ``PyConfig_Get("base_exec_prefix")``
699-
instead. Use ``PySys_GetObject("exec_prefix")`` (:data:`sys.exec_prefix`)
700-
or ``PyConfig_Get("exec_prefix")`` if :ref:`virtual environments
701-
<venv-def>` need to be handled.
702-
696+
Use :c:func:`PyConfig_Get("base_exec_prefix") <PyConfig_Get>`
697+
(:data:`sys.base_exec_prefix`) instead. Use
698+
:c:func:`PyConfig_Get("exec_prefix") <PyConfig_Get>`
699+
(:data:`sys.exec_prefix`) if :ref:`virtual environments <venv-def>` need
700+
to be handled.
703701

704702
.. c:function:: wchar_t* Py_GetProgramFullPath()
705703
@@ -719,8 +717,8 @@ Process-wide parameters
719717
It now returns ``NULL`` if called before :c:func:`Py_Initialize`.
720718

721719
.. deprecated-removed:: 3.13 3.15
722-
Use ``PySys_GetObject("executable")`` (:data:`sys.executable`) or
723-
``PyConfig_Get("executable")`` instead.
720+
Use :c:func:`PyConfig_Get("executable") <PyConfig_Get>`
721+
(:data:`sys.executable`) instead.
724722

725723

726724
.. c:function:: wchar_t* Py_GetPath()
@@ -748,9 +746,8 @@ Process-wide parameters
748746
It now returns ``NULL`` if called before :c:func:`Py_Initialize`.
749747

750748
.. deprecated-removed:: 3.13 3.15
751-
Use ``PySys_GetObject("path")`` (:data:`sys.path`)
752-
or ``PyConfig_Get("module_search_paths")`` instead.
753-
749+
Use :c:func:`PyConfig_Get("module_search_paths") <PyConfig_Get>`
750+
(:data:`sys.path`) instead.
754751

755752
.. c:function:: const char* Py_GetVersion()
756753
@@ -935,8 +932,8 @@ Process-wide parameters
935932
It now returns ``NULL`` if called before :c:func:`Py_Initialize`.
936933
937934
.. deprecated-removed:: 3.13 3.15
938-
Use :c:func:`PyConfig_Get("home") <PyConfig_Get>`
939-
or the :envvar:`PYTHONHOME` environment variable instead.
935+
Use :c:func:`PyConfig_Get("home") <PyConfig_Get>` or the
936+
:envvar:`PYTHONHOME` environment variable instead.
940937
941938
942939
.. _threads:

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

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -12,31 +12,33 @@ Pending removal in Python 3.15
1212
Use :c:type:`wchar_t` instead.
1313
* Python initialization functions, deprecated in Python 3.13:
1414

15-
* :c:func:`Py_GetExecPrefix`:
16-
Use ``PySys_GetObject("base_exec_prefix")`` (:data:`sys.base_exec_prefix`)
17-
or ``PyConfig_Get("base_exec_prefix")`` instead. Use
18-
``PySys_GetObject("exec_prefix")`` (:data:`sys.exec_prefix`) or
19-
``PyConfig_Get("exec_prefix")`` if :ref:`virtual environments <venv-def>`
20-
need to be handled.
2115
* :c:func:`Py_GetPath`:
22-
Use ``PySys_GetObject("path")`` (:data:`sys.path`)
23-
or ``PyConfig_Get("module_search_paths")`` instead.
16+
Use :c:func:`PyConfig_Get("module_search_paths") <PyConfig_Get>`
17+
(:data:`sys.path`) instead.
2418
* :c:func:`Py_GetPrefix`:
25-
Use ``PySys_GetObject("base_prefix")`` (:data:`sys.base_prefix`) or
26-
``PyConfig_Get("base_prefix")`` instead. Use ``PySys_GetObject("prefix")``
27-
(:data:`sys.prefix`) or ``PyConfig_Get("prefix")`` if :ref:`virtual
28-
environments <venv-def>` need to be handled.
19+
Use :c:func:`PyConfig_Get("base_prefix") <PyConfig_Get>`
20+
(:data:`sys.base_prefix`) instead. Use :c:func:`PyConfig_Get("prefix")
21+
<PyConfig_Get>` (:data:`sys.prefix`) if :ref:`virtual environments
22+
<venv-def>` need to be handled.
23+
* :c:func:`Py_GetExecPrefix`:
24+
Use :c:func:`PyConfig_Get("base_exec_prefix") <PyConfig_Get>`
25+
(:data:`sys.base_exec_prefix`) instead. Use
26+
:c:func:`PyConfig_Get("exec_prefix") <PyConfig_Get>`
27+
(:data:`sys.exec_prefix`) if :ref:`virtual environments <venv-def>` need to
28+
be handled.
2929
* :c:func:`Py_GetProgramFullPath`:
30-
Use ``PySys_GetObject("executable")`` (:data:`sys.executable`)
31-
or ``PyConfig_Get("executable")`` instead.
30+
Use :c:func:`PyConfig_Get("executable") <PyConfig_Get>`
31+
(:data:`sys.executable`) instead.
3232
* :c:func:`Py_GetProgramName`:
33-
Use ``PySys_GetObject("executable")`` (:data:`sys.executable`)
34-
or ``PyConfig_Get("executable")`` instead.
33+
Use :c:func:`PyConfig_Get("executable") <PyConfig_Get>`
34+
(:data:`sys.executable`) instead.
3535
* :c:func:`Py_GetPythonHome`:
36-
Use :c:func:`PyConfig_Get("home") <PyConfig_Get>`
37-
or the :envvar:`PYTHONHOME` environment variable instead.
36+
Use :c:func:`PyConfig_Get("home") <PyConfig_Get>` or the
37+
:envvar:`PYTHONHOME` environment variable instead.
3838

39-
See also the :c:func:`PyConfig_Get` function.
39+
The `pythoncapi-compat project
40+
<https://github.com/python/pythoncapi-compat/>`__ can be used to get
41+
:c:func:`PyConfig_Get` on Python 3.13 and older.
4042

4143
* Functions to configure Python's initialization, deprecated in Python 3.11:
4244

0 commit comments

Comments
 (0)