It now returns ``NULL`` if called before :c:func:`Py_Initialize`.
.. deprecated-removed:: 3.13 3.15
- Get :data:`sys.executable` instead.
+ Use :c:func:`PyConfig_Get("executable") <PyConfig_Get>`
+ (:data:`sys.executable`) instead.
.. c:function:: wchar_t* Py_GetPrefix()
It now returns ``NULL`` if called before :c:func:`Py_Initialize`.
.. deprecated-removed:: 3.13 3.15
- Get :data:`sys.base_prefix` instead, or :data:`sys.prefix` if
- :ref:`virtual environments <venv-def>` need to be handled.
+ Use :c:func:`PyConfig_Get("base_prefix") <PyConfig_Get>`
+ (:data:`sys.base_prefix`) instead. Use :c:func:`PyConfig_Get("prefix")
+ <PyConfig_Get>` (:data:`sys.prefix`) if :ref:`virtual environments
+ <venv-def>` need to be handled.
.. c:function:: wchar_t* Py_GetExecPrefix()
It now returns ``NULL`` if called before :c:func:`Py_Initialize`.
.. deprecated-removed:: 3.13 3.15
- Get :data:`sys.base_exec_prefix` instead, or :data:`sys.exec_prefix` if
- :ref:`virtual environments <venv-def>` need to be handled.
-
+ Use :c:func:`PyConfig_Get("base_exec_prefix") <PyConfig_Get>`
+ (:data:`sys.base_exec_prefix`) instead. Use
+ :c:func:`PyConfig_Get("exec_prefix") <PyConfig_Get>`
+ (:data:`sys.exec_prefix`) if :ref:`virtual environments <venv-def>` need
+ to be handled.
.. c:function:: wchar_t* Py_GetProgramFullPath()
It now returns ``NULL`` if called before :c:func:`Py_Initialize`.
.. deprecated-removed:: 3.13 3.15
- Get :data:`sys.executable` instead.
+ Use :c:func:`PyConfig_Get("executable") <PyConfig_Get>`
+ (:data:`sys.executable`) instead.
.. c:function:: wchar_t* Py_GetPath()
It now returns ``NULL`` if called before :c:func:`Py_Initialize`.
.. deprecated-removed:: 3.13 3.15
- Get :data:`sys.path` instead.
-
+ Use :c:func:`PyConfig_Get("module_search_paths") <PyConfig_Get>`
+ (:data:`sys.path`) instead.
.. c:function:: const char* Py_GetVersion()
It now returns ``NULL`` if called before :c:func:`Py_Initialize`.
.. deprecated-removed:: 3.13 3.15
- Get :c:member:`PyConfig.home` or :envvar:`PYTHONHOME` environment
- variable instead.
+ Use :c:func:`PyConfig_Get("home") <PyConfig_Get>` or the
+ :envvar:`PYTHONHOME` environment variable instead.
.. _threads:
:c:func:`PyWeakref_GetRef` on Python 3.12 and older.
* :c:type:`Py_UNICODE` type and the :c:macro:`!Py_UNICODE_WIDE` macro:
Use :c:type:`wchar_t` instead.
-* Python initialization functions:
+* Python initialization functions, deprecated in Python 3.13:
- * :c:func:`PySys_ResetWarnOptions`:
- Clear :data:`sys.warnoptions` and :data:`!warnings.filters` instead.
- * :c:func:`Py_GetExecPrefix`:
- Get :data:`sys.base_exec_prefix` and :data:`sys.exec_prefix` instead.
* :c:func:`Py_GetPath`:
- Get :data:`sys.path` instead.
+ Use :c:func:`PyConfig_Get("module_search_paths") <PyConfig_Get>`
+ (:data:`sys.path`) instead.
* :c:func:`Py_GetPrefix`:
- Get :data:`sys.base_prefix` and :data:`sys.prefix` instead.
+ Use :c:func:`PyConfig_Get("base_prefix") <PyConfig_Get>`
+ (:data:`sys.base_prefix`) instead. Use :c:func:`PyConfig_Get("prefix")
+ <PyConfig_Get>` (:data:`sys.prefix`) if :ref:`virtual environments
+ <venv-def>` need to be handled.
+ * :c:func:`Py_GetExecPrefix`:
+ Use :c:func:`PyConfig_Get("base_exec_prefix") <PyConfig_Get>`
+ (:data:`sys.base_exec_prefix`) instead. Use
+ :c:func:`PyConfig_Get("exec_prefix") <PyConfig_Get>`
+ (:data:`sys.exec_prefix`) if :ref:`virtual environments <venv-def>` need to
+ be handled.
* :c:func:`Py_GetProgramFullPath`:
- Get :data:`sys.executable` instead.
+ Use :c:func:`PyConfig_Get("executable") <PyConfig_Get>`
+ (:data:`sys.executable`) instead.
* :c:func:`Py_GetProgramName`:
- Get :data:`sys.executable` instead.
+ Use :c:func:`PyConfig_Get("executable") <PyConfig_Get>`
+ (:data:`sys.executable`) instead.
* :c:func:`Py_GetPythonHome`:
- Get :c:func:`PyConfig_Get("home") <PyConfig_Get>`
- or the :envvar:`PYTHONHOME` environment variable instead.
+ Use :c:func:`PyConfig_Get("home") <PyConfig_Get>` or the
+ :envvar:`PYTHONHOME` environment variable instead.
- See also the :c:func:`PyConfig_Get` function.
+ The `pythoncapi-compat project
+ <https://github.com/python/pythoncapi-compat/>`__ can be used to get
+ :c:func:`PyConfig_Get` on Python 3.13 and older.
* Functions to configure Python's initialization, deprecated in Python 3.11:
Set :c:member:`PyConfig.program_name` instead.
* :c:func:`!Py_SetPythonHome()`:
Set :c:member:`PyConfig.home` instead.
+ * :c:func:`PySys_ResetWarnOptions`:
+ Clear :data:`sys.warnoptions` and :data:`!warnings.filters` instead.
The :c:func:`Py_InitializeFromConfig` API should be used with
:c:type:`PyConfig` instead.