Commit 43b563f7 authored by Victor Stinner's avatar Victor Stinner

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.
........
parent 55a8a3a0
...@@ -184,6 +184,9 @@ Core and Builtins ...@@ -184,6 +184,9 @@ Core and Builtins
Library Library
------- -------
- Issue #8412: os.system() now accepts bytes, bytearray and str with
surrogates.
- Issue #4282: Fix the main function of the profile module for a non-ASCII - Issue #4282: Fix the main function of the profile module for a non-ASCII
script, open the file in binary mode and not in text mode with the default script, open the file in binary mode and not in text mode with the default
(utf8) encoding. (utf8) encoding.
......
...@@ -2814,18 +2814,23 @@ posix_system(PyObject *self, PyObject *args) ...@@ -2814,18 +2814,23 @@ posix_system(PyObject *self, PyObject *args)
wchar_t *command; wchar_t *command;
if (!PyArg_ParseTuple(args, "u:system", &command)) if (!PyArg_ParseTuple(args, "u:system", &command))
return NULL; return NULL;
Py_BEGIN_ALLOW_THREADS
sts = _wsystem(command);
Py_END_ALLOW_THREADS
#else #else
PyObject *command_obj;
char *command; char *command;
if (!PyArg_ParseTuple(args, "s:system", &command)) if (!PyArg_ParseTuple(args, "O&:system",
PyUnicode_FSConverter, &command_obj))
return NULL; return NULL;
#endif
command = bytes2str(command_obj, 1);
Py_BEGIN_ALLOW_THREADS Py_BEGIN_ALLOW_THREADS
#ifdef MS_WINDOWS
sts = _wsystem(command);
#else
sts = system(command); sts = system(command);
#endif
Py_END_ALLOW_THREADS Py_END_ALLOW_THREADS
release_bytes(command_obj);
#endif
return PyLong_FromLong(sts); return PyLong_FromLong(sts);
} }
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment