summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2023-06-01 12:06:32 (GMT)
committerGitHub <noreply@github.com>2023-06-01 12:06:32 (GMT)
commitc67121ac6bf8ee36d79de92ef68fc3fde178d2a3 (patch)
treedc23a71f3b65e9dc384d85992a9f73c46c0f6af3 /Modules
parentec0082ca460f6b5eaf987536d28d6bc252322307 (diff)
downloadcpython-c67121ac6bf8ee36d79de92ef68fc3fde178d2a3.zip
cpython-c67121ac6bf8ee36d79de92ef68fc3fde178d2a3.tar.gz
cpython-c67121ac6bf8ee36d79de92ef68fc3fde178d2a3.tar.bz2
gh-105145: Deprecate Py_GetPath() function (#105179)
Deprecate old Python initialization functions: * PySys_ResetWarnOptions() * Py_GetExecPrefix() * Py_GetPath() * Py_GetPrefix() * Py_GetProgramFullPath() * Py_GetProgramName() * Py_GetPythonHome() _tkinter.c uses sys.executable instead of Py_GetProgramName() and uses sys.prefix instead of Py_GetPrefix().
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_tkinter.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/Modules/_tkinter.c b/Modules/_tkinter.c
index 49c9444..f06e624 100644
--- a/Modules/_tkinter.c
+++ b/Modules/_tkinter.c
@@ -130,11 +130,10 @@ _get_tcl_lib_path(void)
static int already_checked = 0;
if (already_checked == 0) {
- PyObject *prefix;
struct stat stat_buf;
int stat_return_value;
- prefix = PyUnicode_FromWideChar(Py_GetPrefix(), -1);
+ PyObject *prefix = PySys_GetObject("prefix"); // borrowed reference
if (prefix == NULL) {
return NULL;
}
@@ -3289,8 +3288,8 @@ PyInit__tkinter(void)
/* This helps the dynamic loader; in Unicode aware Tcl versions
it also helps Tcl find its encodings. */
- uexe = PyUnicode_FromWideChar(Py_GetProgramName(), -1);
- if (uexe) {
+ uexe = PySys_GetObject("executable"); // borrowed reference
+ if (uexe && PyUnicode_Check(uexe)) { // sys.executable can be None
cexe = PyUnicode_EncodeFSDefault(uexe);
if (cexe) {
#ifdef MS_WINDOWS
@@ -3329,7 +3328,6 @@ PyInit__tkinter(void)
#endif /* MS_WINDOWS */
}
Py_XDECREF(cexe);
- Py_DECREF(uexe);
}
if (PyErr_Occurred()) {