patch 7.4.905
Problem: Python interface can produce error "vim.message' object has no
attribute 'isatty'".
Solution: Add dummy isatty(), readable(), etc. (closes #464)
diff --git a/src/if_py_both.h b/src/if_py_both.h
index 497db86..e2f4857 100644
--- a/src/if_py_both.h
+++ b/src/if_py_both.h
@@ -465,20 +465,41 @@
}
static PyObject *
-OutputFlush(PyObject *self UNUSED)
+AlwaysNone(PyObject *self UNUSED)
{
/* do nothing */
Py_INCREF(Py_None);
return Py_None;
}
+ static PyObject *
+AlwaysFalse(PyObject *self UNUSED)
+{
+ /* do nothing */
+ Py_INCREF(Py_False);
+ return Py_False;
+}
+
+ static PyObject *
+AlwaysTrue(PyObject *self UNUSED)
+{
+ /* do nothing */
+ Py_INCREF(Py_True);
+ return Py_True;
+}
+
/***************/
static struct PyMethodDef OutputMethods[] = {
/* name, function, calling, doc */
{"write", (PyCFunction)OutputWrite, METH_O, ""},
{"writelines", (PyCFunction)OutputWritelines, METH_O, ""},
- {"flush", (PyCFunction)OutputFlush, METH_NOARGS, ""},
+ {"flush", (PyCFunction)AlwaysNone, METH_NOARGS, ""},
+ {"close", (PyCFunction)AlwaysNone, METH_NOARGS, ""},
+ {"isatty", (PyCFunction)AlwaysFalse, METH_NOARGS, ""},
+ {"readable", (PyCFunction)AlwaysFalse, METH_NOARGS, ""},
+ {"seekable", (PyCFunction)AlwaysFalse, METH_NOARGS, ""},
+ {"writable", (PyCFunction)AlwaysTrue, METH_NOARGS, ""},
{"__dir__", (PyCFunction)OutputDir, METH_NOARGS, ""},
{ NULL, NULL, 0, NULL}
};