[Python-3000-checkins] r59065 - python/branches/py3k/Modules/posixmodule.c

amaury.forgeotdarc python-3000-checkins at python.org
Tue Nov 20 02:52:15 CET 2007


Author: amaury.forgeotdarc
Date: Tue Nov 20 02:52:14 2007
New Revision: 59065

Modified:
   python/branches/py3k/Modules/posixmodule.c
Log:
os.system: on Windows, avoid encoding the command and use the "wide" function: _wsystem


Modified: python/branches/py3k/Modules/posixmodule.c
==============================================================================
--- python/branches/py3k/Modules/posixmodule.c	(original)
+++ python/branches/py3k/Modules/posixmodule.c	Tue Nov 20 02:52:14 2007
@@ -2540,12 +2540,22 @@
 static PyObject *
 posix_system(PyObject *self, PyObject *args)
 {
-	char *command;
 	long sts;
+#ifdef MS_WINDOWS
+	wchar_t *command;
+	if (!PyArg_ParseTuple(args, "u:system", &command))
+		return NULL;
+#else
+	char *command;
 	if (!PyArg_ParseTuple(args, "s:system", &command))
 		return NULL;
+#endif
 	Py_BEGIN_ALLOW_THREADS
+#ifdef MS_WINDOWS
+	sts = _wsystem(command);
+#else
 	sts = system(command);
+#endif
 	Py_END_ALLOW_THREADS
 	return PyInt_FromLong(sts);
 }


More information about the Python-3000-checkins mailing list