Commit 9ad853bc authored by Martin v. Löwis's avatar Martin v. Löwis

Patch #788404: ignore "b" and "t" mode modifiers in posix_popen.

Fixes #703198. Backported to 2.3.
parent 9885c93b
......@@ -4348,6 +4348,11 @@ posix_popen(PyObject *self, PyObject *args)
PyObject *f;
if (!PyArg_ParseTuple(args, "s|si:popen", &name, &mode, &bufsize))
return NULL;
/* Strip mode of binary or text modifiers */
if (strcmp(mode, "rb") == 0 || strcmp(mode, "rt") == 0)
mode = "r";
else if (strcmp(mode, "wb") == 0 || strcmp(mode, "wt") == 0)
mode = "w";
Py_BEGIN_ALLOW_THREADS
fp = popen(name, mode);
Py_END_ALLOW_THREADS
......
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