Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit eb9b39b

Browse files
committed
Paths and file names from the fs should always be decoded with PyUnicode_DecodeFSDefault and not PyUnicode_FromString
1 parent fef9bba commit eb9b39b

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

Python/sysmodule.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1072,11 +1072,12 @@ _PySys_Init(void)
10721072
SET_SYS_FROM_STRING("platform",
10731073
PyUnicode_FromString(Py_GetPlatform()));
10741074
SET_SYS_FROM_STRING("executable",
1075-
PyUnicode_FromString(Py_GetProgramFullPath()));
1075+
PyUnicode_DecodeFSDefault(
1076+
Py_GetProgramFullPath()));
10761077
SET_SYS_FROM_STRING("prefix",
1077-
PyUnicode_FromString(Py_GetPrefix()));
1078+
PyUnicode_DecodeFSDefault(Py_GetPrefix()));
10781079
SET_SYS_FROM_STRING("exec_prefix",
1079-
PyUnicode_FromString(Py_GetExecPrefix()));
1080+
PyUnicode_DecodeFSDefault(Py_GetExecPrefix()));
10801081
SET_SYS_FROM_STRING("maxint",
10811082
PyInt_FromLong(PyInt_GetMax()));
10821083
SET_SYS_FROM_STRING("maxsize",

0 commit comments

Comments
 (0)