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

updated for version 7.3.1236

Problem:    Python: WindowSetattr() missing support for NUMBER_UNSIGNED.
Solution:   Add NUMBER_UNSIGNED, add more tests. Various fixes. (ZyX)
This commit is contained in:
Bram Moolenaar
2013-06-23 16:35:47 +02:00
parent ede3e6383d
commit dee2e315d7
14 changed files with 549 additions and 225 deletions

View File

@@ -1611,7 +1611,7 @@ DictionaryContains(DictionaryObject *self, PyObject *keyObject)
ret = (rObj == Py_True);
Py_DECREF(Py_True);
Py_DECREF(rObj);
return ret;
}
@@ -1910,7 +1910,7 @@ DictionaryUpdate(DictionaryObject *self, PyObject *args, PyObject *kwargs)
PyErr_FORMAT(PyExc_ValueError,
N_("expected sequence element of size 2, "
"but got sequence of size %d"),
PySequence_Fast_GET_SIZE(fast));
(int) PySequence_Fast_GET_SIZE(fast));
return NULL;
}
@@ -2435,6 +2435,10 @@ ListAssSlice(ListObject *self, Py_ssize_t first, Py_ssize_t last, PyObject *obj)
clear_tv(&v);
}
Py_DECREF(iterator);
if (PyErr_Occurred())
return -1;
return 0;
}
@@ -3361,7 +3365,7 @@ WindowSetattr(WindowObject *self, char *name, PyObject *valObject)
long height;
win_T *savewin;
if (NumberToLong(valObject, &height, NUMBER_INT))
if (NumberToLong(valObject, &height, NUMBER_INT|NUMBER_UNSIGNED))
return -1;
#ifdef FEAT_GUI
@@ -3384,7 +3388,7 @@ WindowSetattr(WindowObject *self, char *name, PyObject *valObject)
long width;
win_T *savewin;
if (NumberToLong(valObject, &width, NUMBER_INT))
if (NumberToLong(valObject, &width, NUMBER_INT|NUMBER_UNSIGNED))
return -1;
#ifdef FEAT_GUI
@@ -3518,7 +3522,7 @@ StringToLine(PyObject *obj)
char *str;
char *save;
PyObject *bytes = NULL;
Py_ssize_t len;
Py_ssize_t len = 0;
PyInt i;
char *p;
@@ -5483,6 +5487,7 @@ _ConvertFromPyObject(PyObject *obj, typval_T *tv, PyObject *lookup_dict)
#endif
else if (PyObject_HasAttrString(obj, "keys"))
return convert_dl(obj, tv, pymap_to_tv, lookup_dict);
/* PyObject_GetIter can create built-in iterator for any sequence object */
else if (PyIter_Check(obj) || PySequence_Check(obj))
return convert_dl(obj, tv, pyseq_to_tv, lookup_dict);
else if (PyMapping_Check(obj))
@@ -5930,11 +5935,8 @@ static struct object_constant {
{"_Loader", (PyObject *)&LoaderType},
};
typedef int (*object_adder)(PyObject *, const char *, PyObject *);
typedef PyObject *(*attr_getter)(PyObject *, const char *);
#define ADD_OBJECT(m, name, obj) \
if (add_object(m, name, obj)) \
if (PyModule_AddObject(m, name, obj)) \
return -1;
#define ADD_CHECKED_OBJECT(m, name, obj) \
@@ -5946,7 +5948,7 @@ typedef PyObject *(*attr_getter)(PyObject *, const char *);
}
static int
populate_module(PyObject *m, object_adder add_object, attr_getter get_attr)
populate_module(PyObject *m)
{
int i;
PyObject *other_module;
@@ -5990,7 +5992,7 @@ populate_module(PyObject *m, object_adder add_object, attr_getter get_attr)
if (!(py_chdir = PyObject_GetAttrString(other_module, "chdir")))
return -1;
ADD_OBJECT(m, "_chdir", py_chdir);
if (!(attr = get_attr(m, "chdir")))
if (!(attr = PyObject_GetAttrString(m, "chdir")))
return -1;
if (PyObject_SetAttrString(other_module, "chdir", attr))
{
@@ -6002,7 +6004,7 @@ populate_module(PyObject *m, object_adder add_object, attr_getter get_attr)
if ((py_fchdir = PyObject_GetAttrString(other_module, "fchdir")))
{
ADD_OBJECT(m, "_fchdir", py_fchdir);
if (!(attr = get_attr(m, "fchdir")))
if (!(attr = PyObject_GetAttrString(m, "fchdir")))
return -1;
if (PyObject_SetAttrString(other_module, "fchdir", attr))
{