PySys_SetArgv(), PySys_SetArgvEx(), Py_SetProgramName() and Py_SetPythonHome() are deprecated since Python 3.11 and planned for removal in Python 3.16.
The "global configuration variables" such as Py_IgnoreEnvironmentFlag are deprecated since Python 3.11 and planned for removal in Python 3.16.
I'm working on changes to remove these APIs. The PyInitConfig API (Python 3.14) or the PyConfig API (Python 3.8) can be used instead. Reading global configuration variables can be replaced with PyConfig_Get().
In May 2025, there was a first attempt to remove global configuration variables. A code search found 20 projects still using these variables. The removal was (postponed)(#149594) from Python 3.15 to Python 3.16.
See also issue gh-154757 "26 C APIs scheduled for removal in 3.16 are still present".
changed the title [-]C API: Remove deprecate API to configure Python initialization[/-][+]C API: Remove deprecated API to configure Python initialization[/+]on Sep 23, 2026
Activity
gh-158001: Avoid deprecated variable in Py_GETENV() (#158003)
pythongh-158001: No longer read global config vars in PyConfig_Read()
pythongh-158001: No longer read global config vars in PyConfig_Read()
gh-158001: No longer read global config vars in PyConfig_Read() (#158014
pythongh-158001: Remove global configuration variables from C API
pythongh-158001: Remove global configuration variables from C API
pythongh-158001: Remove Py_SetProgramName() function
pythongh-158001: Remove Py_SetProgramName() function
gh-158001: Remove Py_SetProgramName() function (#158024)
gh-158001: Remove global configuration variables from C API (#158020)
vstinner commented on Sep 24, 2026
I created https://discuss.python.org/t/c-api-migrate-embedded-python-to-pyconfig-and-pyinitconfig-apis/109215 discussion to communicate on these removed functions and variables.
gh-158001: Fix test_ctypes.test_version_var() on s390x (#158193)