Author: guido.van.rossum
Date: Fri Jun 15 05:49:03 2007
New Revision: 55991

Modified:
   python/branches/py3k-struni/Lib/test/test_popen.py
   python/branches/py3k-struni/Python/sysmodule.c
Log:
Make sys.path and sys.argv into lists of strings.
Remove the hack in test_popen.py to overcome this issue.


Modified: python/branches/py3k-struni/Lib/test/test_popen.py
==============================================================================
--- python/branches/py3k-struni/Lib/test/test_popen.py  (original)
+++ python/branches/py3k-struni/Lib/test/test_popen.py  Fri Jun 15 05:49:03 2007
@@ -20,7 +20,7 @@
 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]

Modified: python/branches/py3k-struni/Python/sysmodule.c
==============================================================================
--- python/branches/py3k-struni/Python/sysmodule.c      (original)
+++ python/branches/py3k-struni/Python/sysmodule.c      Fri Jun 15 05:49:03 2007
@@ -1145,7 +1145,7 @@
                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 @@
                        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 @@
 #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)
_______________________________________________
Python-3000-checkins mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-3000-checkins

Reply via email to