From: vsr Date: Tue, 26 Jan 2021 09:29:28 +0000 (+0300) Subject: From Community Forum: add isatty() method to embedded interpreter (needed for some... X-Git-Tag: V9_7_0a1~24 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=9d669a6ac510d80e46f8b972ff64da5f42690ce6;p=modules%2Fgui.git From Community Forum: add isatty() method to embedded interpreter (needed for some custom Python packages like dolfin) --- diff --git a/tools/PyInterp/src/PyInterp_Interp.cxx b/tools/PyInterp/src/PyInterp_Interp.cxx index 38f522310..deca49c79 100644 --- a/tools/PyInterp/src/PyInterp_Interp.cxx +++ b/tools/PyInterp/src/PyInterp_Interp.cxx @@ -78,10 +78,17 @@ PyStdOut_flush(PyStdOut * /*self*/, PyObject * /*args*/) return Py_None; } +static PyObject* +PyStdOut_isatty(PyStdOut * /*self*/, PyObject */*args*/) +{ + return Py_False; +} + static PyMethodDef PyStdOut_methods[] = { {"write", (PyCFunction)PyStdOut_write, METH_VARARGS, PyDoc_STR("write(string) -> None")}, {"flush", (PyCFunction)PyStdOut_flush, METH_NOARGS, PyDoc_STR("flush() -> None")}, - {NULL, (PyCFunction)NULL, 0, NULL} /* sentinel */ + {"isatty", (PyCFunction)PyStdOut_isatty, METH_NOARGS, PyDoc_STR("isatty() -> bool")}, + {NULL, (PyCFunction)NULL, 0, NULL} /* sentinel */ }; static PyMemberDef PyStdOut_memberlist[] = {