summaryrefslogtreecommitdiffstats
path: root/Python/pathconfig.c
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2023-06-01 07:14:02 (GMT)
committerGitHub <noreply@github.com>2023-06-01 07:14:02 (GMT)
commit424049cc1117d66dfa86196ee5f694c15b46ac6c (patch)
tree92dbbd5558deb687efb53e653d667ba6af608930 /Python/pathconfig.c
parent8ed705c083e8e5ff37649d998a8b1524ec921519 (diff)
downloadcpython-424049cc1117d66dfa86196ee5f694c15b46ac6c.zip
cpython-424049cc1117d66dfa86196ee5f694c15b46ac6c.tar.gz
cpython-424049cc1117d66dfa86196ee5f694c15b46ac6c.tar.bz2
gh-105145: Remove old functions to config Python init (#105154)
Remove the following old functions to configure the Python initialization, deprecated in Python 3.11: * PySys_AddWarnOptionUnicode() * PySys_AddWarnOption() * PySys_AddXOption() * PySys_HasWarnOptions() * PySys_SetArgvEx() * PySys_SetArgv() * PySys_SetPath() * Py_SetPath() * Py_SetProgramName() * Py_SetPythonHome() * Py_SetStandardStreamEncoding() * _Py_SetProgramFullPath() Most of these functions are kept in the stable ABI, except: * Py_SetStandardStreamEncoding() * _Py_SetProgramFullPath() Update Doc/extending/embedding.rst and Doc/extending/extending.rst to use the new PyConfig API. _testembed.c: * check_stdio_details() now sets stdio_encoding and stdio_errors of PyConfig. * Add definitions of functions removed from the API but kept in the stable ABI. * test_init_from_config() and test_init_read_set() now use PyConfig_SetString() instead of PyConfig_SetBytesString(). Remove _Py_ClearStandardStreamEncoding() internal function.
Diffstat (limited to 'Python/pathconfig.c')
-rw-r--r--Python/pathconfig.c31
1 files changed, 6 insertions, 25 deletions
diff --git a/Python/pathconfig.c b/Python/pathconfig.c
index be0f97c..afffa13 100644
--- a/Python/pathconfig.c
+++ b/Python/pathconfig.c
@@ -211,7 +211,8 @@ path_out_of_memory(const char *func)
_Py_FatalErrorFunc(func, "out of memory");
}
-void
+// Removed in Python 3.13 API, but kept for the stable ABI
+PyAPI_FUNC(void)
Py_SetPath(const wchar_t *path)
{
if (path == NULL) {
@@ -252,7 +253,8 @@ Py_SetPath(const wchar_t *path)
}
-void
+// Removed in Python 3.13 API, but kept for the stable ABI
+PyAPI_FUNC(void)
Py_SetPythonHome(const wchar_t *home)
{
int has_value = home && home[0];
@@ -275,7 +277,8 @@ Py_SetPythonHome(const wchar_t *home)
}
-void
+// Removed in Python 3.13 API, but kept for the stable ABI
+PyAPI_FUNC(void)
Py_SetProgramName(const wchar_t *program_name)
{
int has_value = program_name && program_name[0];
@@ -297,28 +300,6 @@ Py_SetProgramName(const wchar_t *program_name)
}
}
-void
-_Py_SetProgramFullPath(const wchar_t *program_full_path)
-{
- int has_value = program_full_path && program_full_path[0];
-
- PyMemAllocatorEx old_alloc;
- _PyMem_SetDefaultAllocator(PYMEM_DOMAIN_RAW, &old_alloc);
-
- PyMem_RawFree(_Py_path_config.program_full_path);
- _Py_path_config.program_full_path = NULL;
-
- if (has_value) {
- _Py_path_config.program_full_path = _PyMem_RawWcsdup(program_full_path);
- }
-
- PyMem_SetAllocator(PYMEM_DOMAIN_RAW, &old_alloc);
-
- if (has_value && _Py_path_config.program_full_path == NULL) {
- path_out_of_memory(__func__);
- }
-}
-
wchar_t *
Py_GetPath(void)