Mercurial > vim
comparison src/if_py_both.h @ 4411:1afdb7d21c14 v7.3.954
updated for version 7.3.954
Problem: No check if PyObject_IsTrue fails.
Solution: Add a check for -1 value. (ZyX)
author | Bram Moolenaar <bram@vim.org> |
---|---|
date | Wed, 15 May 2013 16:11:50 +0200 |
parents | 2a166caf8709 |
children | 0bbacb6a83bd |
comparison
equal
deleted
inserted
replaced
4410:dc9e62f8cbb5 | 4411:1afdb7d21c14 |
---|---|
698 PyErr_SetString(PyExc_TypeError, _("Cannot modify fixed dictionary")); | 698 PyErr_SetString(PyExc_TypeError, _("Cannot modify fixed dictionary")); |
699 return -1; | 699 return -1; |
700 } | 700 } |
701 else | 701 else |
702 { | 702 { |
703 if (PyObject_IsTrue(val)) | 703 int istrue = PyObject_IsTrue(val); |
704 if (istrue == -1) | |
705 return -1; | |
706 else if (istrue) | |
704 this->dict->dv_lock = VAR_LOCKED; | 707 this->dict->dv_lock = VAR_LOCKED; |
705 else | 708 else |
706 this->dict->dv_lock = 0; | 709 this->dict->dv_lock = 0; |
707 } | 710 } |
708 return 0; | 711 return 0; |
1199 PyErr_SetString(PyExc_TypeError, _("cannot modify fixed list")); | 1202 PyErr_SetString(PyExc_TypeError, _("cannot modify fixed list")); |
1200 return -1; | 1203 return -1; |
1201 } | 1204 } |
1202 else | 1205 else |
1203 { | 1206 { |
1204 if (PyObject_IsTrue(val)) | 1207 int istrue = PyObject_IsTrue(val); |
1208 if (istrue == -1) | |
1209 return -1; | |
1210 else if (istrue) | |
1205 this->list->lv_lock = VAR_LOCKED; | 1211 this->list->lv_lock = VAR_LOCKED; |
1206 else | 1212 else |
1207 this->list->lv_lock = 0; | 1213 this->list->lv_lock = 0; |
1208 } | 1214 } |
1209 return 0; | 1215 return 0; |
1477 | 1483 |
1478 opt_flags = (this->opt_type ? OPT_LOCAL : OPT_GLOBAL); | 1484 opt_flags = (this->opt_type ? OPT_LOCAL : OPT_GLOBAL); |
1479 | 1485 |
1480 if (flags & SOPT_BOOL) | 1486 if (flags & SOPT_BOOL) |
1481 { | 1487 { |
1482 r = set_option_value_for(key, PyObject_IsTrue(valObject), NULL, | 1488 int istrue = PyObject_IsTrue(valObject); |
1489 if (istrue == -1) | |
1490 return -1; | |
1491 r = set_option_value_for(key, istrue, NULL, | |
1483 opt_flags, this->opt_type, this->from); | 1492 opt_flags, this->opt_type, this->from); |
1484 } | 1493 } |
1485 else if (flags & SOPT_NUM) | 1494 else if (flags & SOPT_NUM) |
1486 { | 1495 { |
1487 int val; | 1496 int val; |