diff options
author | Bram Moolenaar <Bram@vim.org> | 2015-11-02 13:28:59 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2015-11-02 13:28:59 +0100 |
commit | d424747d5821c2873e24d25d3407d08b25ea3443 (patch) | |
tree | 6e1cfec1e8cb740f95dde8097cb58d3684c3d3c7 /src/if_py_both.h | |
parent | 6407b3e80d7d7f8f0797c13ae35cc06f96be46c9 (diff) | |
download | vim-git-d424747d5821c2873e24d25d3407d08b25ea3443.tar.gz |
patch 7.4.905v7.4.905
Problem: Python interface can produce error "vim.message' object has no
attribute 'isatty'".
Solution: Add dummy isatty(), readable(), etc. (closes #464)
Diffstat (limited to 'src/if_py_both.h')
-rw-r--r-- | src/if_py_both.h | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/src/if_py_both.h b/src/if_py_both.h index 497db8665..e2f4857e4 100644 --- a/src/if_py_both.h +++ b/src/if_py_both.h @@ -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} }; |