summaryrefslogtreecommitdiffstats
path: root/Modules/posixmodule.c
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@haypocalc.com>2010-04-16 12:47:52 (GMT)
committerVictor Stinner <victor.stinner@haypocalc.com>2010-04-16 12:47:52 (GMT)
commita5ab4fcf68104495056d1ddedb9726fed09ba58e (patch)
tree7a9e131ea0abf0c4b5789b0e7d3d2ba9cbf1de44 /Modules/posixmodule.c
parent81eb8d46100beff4acd564319c607df9f70f50cc (diff)
downloadcpython-a5ab4fcf68104495056d1ddedb9726fed09ba58e.zip
cpython-a5ab4fcf68104495056d1ddedb9726fed09ba58e.tar.gz
cpython-a5ab4fcf68104495056d1ddedb9726fed09ba58e.tar.bz2
Merged revisions 80105 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k ........ r80105 | victor.stinner | 2010-04-16 13:45:13 +0200 (ven., 16 avril 2010) | 3 lines Issue #8412: os.system() now accepts bytes, bytearray and str with surrogates. ........
Diffstat (limited to 'Modules/posixmodule.c')
-rw-r--r--Modules/posixmodule.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
index 502bf62..bba75af 100644
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -2814,18 +2814,23 @@ posix_system(PyObject *self, PyObject *args)
wchar_t *command;
if (!PyArg_ParseTuple(args, "u:system", &command))
return NULL;
+
+ Py_BEGIN_ALLOW_THREADS
+ sts = _wsystem(command);
+ Py_END_ALLOW_THREADS
#else
+ PyObject *command_obj;
char *command;
- if (!PyArg_ParseTuple(args, "s:system", &command))
+ if (!PyArg_ParseTuple(args, "O&:system",
+ PyUnicode_FSConverter, &command_obj))
return NULL;
-#endif
+
+ command = bytes2str(command_obj, 1);
Py_BEGIN_ALLOW_THREADS
-#ifdef MS_WINDOWS
- sts = _wsystem(command);
-#else
sts = system(command);
-#endif
Py_END_ALLOW_THREADS
+ release_bytes(command_obj);
+#endif
return PyLong_FromLong(sts);
}
#endif