From 9d669a6ac510d80e46f8b972ff64da5f42690ce6 Mon Sep 17 00:00:00 2001 From: vsr Date: Tue, 26 Jan 2021 12:29:28 +0300 Subject: [PATCH] From Community Forum: add isatty() method to embedded interpreter (needed for some custom Python packages like dolfin) --- tools/PyInterp/src/PyInterp_Interp.cxx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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[] = { -- 2.39.2