updated for version 7.3.1042
Problem: Python: can't assign to vim.Buffer.name.
Solution: Python patch 3. (ZyX)
diff --git a/src/if_python3.c b/src/if_python3.c
index dfc558a..b7323c2 100644
--- a/src/if_python3.c
+++ b/src/if_python3.c
@@ -638,32 +638,6 @@
#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 *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 @@
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)
{