diff options
author | Bram Moolenaar <Bram@vim.org> | 2013-05-29 22:02:22 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2013-05-29 22:02:22 +0200 |
commit | e9ba516be2873b80e51aa24cd6c25f9b29612695 (patch) | |
tree | 620ac235a6fe7dab512cfc871b7e63ba99bba761 /src/if_python3.c | |
parent | 1bc2428e1f7782870ae9e304f0db2388fe4a5a14 (diff) |
updated for version 7.3.1042v7.3.1042
Problem: Python: can't assign to vim.Buffer.name.
Solution: Python patch 3. (ZyX)
Diffstat (limited to 'src/if_python3.c')
-rw-r--r-- | src/if_python3.c | 35 |
1 files changed, 9 insertions, 26 deletions
diff --git a/src/if_python3.c b/src/if_python3.c index dfc558a583..b7323c2a96 100644 --- a/src/if_python3.c +++ b/src/if_python3.c @@ -638,32 +638,6 @@ static int py3initialised = 0; #define PYINITIALISED py3initialised -#define DICTKEY_DECL PyObject *bytes = NULL; - -#define DICTKEY_GET(err) \ - if (PyBytes_Check(keyObject)) \ - { \ - if (PyString_AsStringAndSize(keyObject, (char **) &key, NULL) == -1) \ - return err; \ - } \ - else if (PyUnicode_Check(keyObject)) \ - { \ - bytes = PyString_AsBytes(keyObject); \ - if (bytes == NULL) \ - return err; \ - if (PyString_AsStringAndSize(bytes, (char **) &key, NULL) == -1) \ - return err; \ - } \ - else \ - { \ - PyErr_SetString(PyExc_TypeError, _("only string keys are allowed")); \ - return err; \ - } - -#define DICTKEY_UNREF \ - if (bytes != NULL) \ - Py_XDECREF(bytes); - #define DESTRUCTOR_FINISH(self) Py_TYPE(self)->tp_free((PyObject*)self) #define WIN_PYTHON_REF(win) win->w_python3_ref @@ -696,6 +670,7 @@ static PyObject *BufferDir(PyObject *); static PyObject *OutputGetattro(PyObject *, PyObject *); static int OutputSetattro(PyObject *, PyObject *, PyObject *); static PyObject *BufferGetattro(PyObject *, PyObject *); +static int BufferSetattro(PyObject *, PyObject *, PyObject *); static PyObject *TabPageGetattro(PyObject *, PyObject *); static PyObject *WindowGetattro(PyObject *, PyObject *); static int WindowSetattro(PyObject *, PyObject *, PyObject *); @@ -1108,6 +1083,14 @@ BufferGetattro(PyObject *self, PyObject*nameobj) return PyObject_GenericGetAttr(self, nameobj); } + static int +BufferSetattro(PyObject *self, PyObject *nameobj, PyObject *val) +{ + GET_ATTR_STRING(name, nameobj); + + return BufferSetattr((BufferObject *)(self), name, val); +} + static PyObject * BufferDir(PyObject *self UNUSED) { |