0
0
mirror of https://github.com/vim/vim.git synced 2025-09-24 03:44:06 -04:00

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)
This commit is contained in:
Bram Moolenaar
2015-11-02 13:28:59 +01:00
parent 6407b3e80d
commit d424747d58
6 changed files with 75 additions and 4 deletions

View File

@@ -465,20 +465,41 @@ OutputWritelines(OutputObject *self, PyObject *seq)
}
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}
};