]> granicus.if.org Git - python/commitdiff
Make sys.path and sys.argv into lists of strings.
authorGuido van Rossum <guido@python.org>
Fri, 15 Jun 2007 03:49:03 +0000 (03:49 +0000)
committerGuido van Rossum <guido@python.org>
Fri, 15 Jun 2007 03:49:03 +0000 (03:49 +0000)
Remove the hack in test_popen.py to overcome this issue.

Lib/test/test_popen.py
Python/sysmodule.c

index fba3f41ca458af5d1582f5eaf6de99170f42cacc..397e4a31ce1243cb814d8c503d6acdd489554fd5 100644 (file)
@@ -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]
index 71a455a82f7f7d92fe2d2f0f97ecdaf4df27602c..245d22ad0c2c5d652d5d455fbd83406ad8bd52ff 100644 (file)
@@ -1145,7 +1145,7 @@ makepathobject(char *path, int delim)
                p = strchr(path, delim);
                if (p == NULL)
                        p = strchr(path, '\0'); /* End of string */
-               w = PyString_FromStringAndSize(path, (Py_ssize_t) (p - path));
+               w = PyUnicode_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 = PyString_FromString(argv[0]);
+                                       v = PyUnicode_FromString(argv[0]);
                                else
-                                       v = PyString_FromString(
+                                       v = PyUnicode_FromString(
                                                decc$translate_vms(argv[0]));
                        } else
-                               v = PyString_FromString(argv[i]);
+                               v = PyUnicode_FromString(argv[i]);
 #else
-                       PyObject *v = PyString_FromString(argv[i]);
+                       PyObject *v = PyUnicode_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 = PyString_FromStringAndSize(argv0, n);
+               a = PyUnicode_FromStringAndSize(argv0, n);
                if (a == NULL)
                        Py_FatalError("no mem for sys.path insertion");
                if (PyList_Insert(path, 0, a) < 0)