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
96ca6916
Commit
96ca6916
authored
Jun 15, 2007
by
Guido van Rossum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make sys.path and sys.argv into lists of strings.
Remove the hack in test_popen.py to overcome this issue.
parent
aa588c46
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
7 deletions
+7
-7
Lib/test/test_popen.py
Lib/test/test_popen.py
+1
-1
Python/sysmodule.c
Python/sysmodule.c
+6
-6
No files found.
Lib/test/test_popen.py
View file @
96ca6916
...
...
@@ -20,7 +20,7 @@ if ' ' in python:
class
PopenTest
(
unittest
.
TestCase
):
def
_do_test_commandline
(
self
,
cmdline
,
expected
):
cmd
=
'%s -c "import sys; print(
list(map(str, sys.argv))
)" %s'
cmd
=
'%s -c "import sys; print(
sys.argv
)" %s'
cmd
=
cmd
%
(
python
,
cmdline
)
data
=
os
.
popen
(
cmd
).
read
()
got
=
eval
(
data
)[
1
:]
# strip off argv[0]
...
...
Python/sysmodule.c
View file @
96ca6916
...
...
@@ -1145,7 +1145,7 @@ makepathobject(char *path, int delim)
p
=
strchr
(
path
,
delim
);
if
(
p
==
NULL
)
p
=
strchr
(
path
,
'\0'
);
/* End of string */
w
=
Py
String
_FromStringAndSize
(
path
,
(
Py_ssize_t
)
(
p
-
path
));
w
=
Py
Unicode
_FromStringAndSize
(
path
,
(
Py_ssize_t
)
(
p
-
path
));
if
(
w
==
NULL
)
{
Py_DECREF
(
v
);
return
NULL
;
...
...
@@ -1190,14 +1190,14 @@ makeargvobject(int argc, char **argv)
if
(
i
==
0
)
{
char
*
fn
=
decc
$
translate_vms
(
argv
[
0
]);
if
((
fn
==
(
char
*
)
0
)
||
fn
==
(
char
*
)
-
1
)
v
=
Py
String
_FromString
(
argv
[
0
]);
v
=
Py
Unicode
_FromString
(
argv
[
0
]);
else
v
=
Py
String
_FromString
(
v
=
Py
Unicode
_FromString
(
decc
$
translate_vms
(
argv
[
0
]));
}
else
v
=
Py
String
_FromString
(
argv
[
i
]);
v
=
Py
Unicode
_FromString
(
argv
[
i
]);
#else
PyObject
*
v
=
Py
String
_FromString
(
argv
[
i
]);
PyObject
*
v
=
Py
Unicode
_FromString
(
argv
[
i
]);
#endif
if
(
v
==
NULL
)
{
Py_DECREF
(
av
);
...
...
@@ -1301,7 +1301,7 @@ PySys_SetArgv(int argc, char **argv)
#endif
/* Unix */
}
#endif
/* All others */
a
=
Py
String
_FromStringAndSize
(
argv0
,
n
);
a
=
Py
Unicode
_FromStringAndSize
(
argv0
,
n
);
if
(
a
==
NULL
)
Py_FatalError
(
"no mem for sys.path insertion"
);
if
(
PyList_Insert
(
path
,
0
,
a
)
<
0
)
...
...
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