diff options
author | Bram Moolenaar <Bram@vim.org> | 2013-05-15 14:51:35 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2013-05-15 14:51:35 +0200 |
commit | 03db85b398746a252345ed8a7da69f0f2591e932 (patch) | |
tree | 7ed0344aa301a35ff620990e64264250182e06fd /src/if_py_both.h | |
parent | b6c589a529bc8c5720477494696c6f69fe457475 (diff) | |
download | vim-03db85b398746a252345ed8a7da69f0f2591e932.zip |
updated for version 7.3.948
Problem: Cannot build with Python 2.2
Solution: Make Python interface work with Python 2.2
Make 2.2 the first supported version. (ZyX)
Diffstat (limited to 'src/if_py_both.h')
-rw-r--r-- | src/if_py_both.h | 28 |
1 files changed, 6 insertions, 22 deletions
diff --git a/src/if_py_both.h b/src/if_py_both.h index 6370bd18a..6f9166950 100644 --- a/src/if_py_both.h +++ b/src/if_py_both.h @@ -564,6 +564,7 @@ IterNew(void *start, destructorfun destruct, nextfun next) return (PyObject *)(self); } +#if 0 /* unused */ static void IterDestructor(PyObject *self) { @@ -573,6 +574,7 @@ IterDestructor(PyObject *self) DESTRUCTOR_FINISH(self); } +#endif static PyObject * IterNext(PyObject *self) @@ -696,13 +698,7 @@ DictionarySetattr(PyObject *self, char *name, PyObject *val) } else { - if (!PyBool_Check(val)) - { - PyErr_SetString(PyExc_TypeError, _("Only boolean objects are allowed")); - return -1; - } - - if (val == Py_True) + if (PyObject_IsTrue(val)) this->dict->dv_lock = VAR_LOCKED; else this->dict->dv_lock = 0; @@ -1202,13 +1198,7 @@ ListSetattr(PyObject *self, char *name, PyObject *val) } else { - if (!PyBool_Check(val)) - { - PyErr_SetString(PyExc_TypeError, _("Only boolean objects are allowed")); - return -1; - } - - if (val == Py_True) + if (PyObject_IsTrue(val)) this->list->lv_lock = VAR_LOCKED; else this->list->lv_lock = 0; @@ -1484,14 +1474,8 @@ OptionsAssItem(OptionsObject *this, PyObject *keyObject, PyObject *valObject) if (flags & SOPT_BOOL) { - if (!PyBool_Check(valObject)) - { - PyErr_SetString(PyExc_ValueError, "Object must be boolean"); - return -1; - } - - r = set_option_value_for(key, (valObject == Py_True), NULL, opt_flags, - this->opt_type, this->from); + r = set_option_value_for(key, PyObject_IsTrue(valObject), NULL, + opt_flags, this->opt_type, this->from); } else if (flags & SOPT_NUM) { |