Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
b0bb1df2
Commit
b0bb1df2
authored
Oct 16, 2010
by
Victor Stinner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
calculate_path(): use _Py_char2wchar() to decode the PATH environment variable,
to support surrogate characters
parent
bd3b71a7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
9 deletions
+4
-9
Modules/getpath.c
Modules/getpath.c
+4
-9
No files found.
Modules/getpath.c
View file @
b0bb1df2
...
...
@@ -407,7 +407,6 @@ calculate_path(void)
wchar_t
rtpypath
[
MAXPATHLEN
+
1
];
wchar_t
*
home
=
Py_GetPythonHome
();
char
*
_path
=
getenv
(
"PATH"
);
wchar_t
wpath
[
MAXPATHLEN
+
1
];
wchar_t
*
path
=
NULL
;
wchar_t
*
prog
=
Py_GetProgramName
();
wchar_t
argv0_path
[
MAXPATHLEN
+
1
];
...
...
@@ -429,14 +428,8 @@ calculate_path(void)
char
execpath
[
MAXPATHLEN
+
1
];
#endif
if
(
_path
)
{
size_t
r
=
mbstowcs
(
wpath
,
_path
,
MAXPATHLEN
+
1
);
path
=
wpath
;
if
(
r
==
(
size_t
)
-
1
||
r
>
MAXPATHLEN
)
{
/* Could not convert PATH, or it's too long. */
path
=
NULL
;
}
}
if
(
_path
)
path
=
_Py_char2wchar
(
_path
,
NULL
);
/* If there is no slash in the argv0 path, then we have to
* assume python is on the user's $PATH, since there's no
...
...
@@ -491,6 +484,8 @@ calculate_path(void)
}
else
progpath
[
0
]
=
'\0'
;
if
(
path
!=
NULL
)
PyMem_Free
(
path
);
if
(
progpath
[
0
]
!=
SEP
&&
progpath
[
0
]
!=
'\0'
)
absolutize
(
progpath
);
wcsncpy
(
argv0_path
,
progpath
,
MAXPATHLEN
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment