# HG changeset patch
# User ZyX <[email protected]>
# Date 1367416122 -14400
# Branch python-extended-2
# Node ID 9a4df126f7c42e0b81df62eba1249300a906f450
# Parent  3b5aba648b4a0b20a0787dce993953cb14e7d55c
Check PyObject_IsTrue for failure

diff -r 3b5aba648b4a -r 9a4df126f7c4 src/if_py_both.h
--- a/src/if_py_both.h  Wed May 01 17:11:52 2013 +0400
+++ b/src/if_py_both.h  Wed May 01 17:48:42 2013 +0400
@@ -698,7 +698,10 @@
        }
        else
        {
-           if (PyObject_IsTrue(val))
+           int         istrue = PyObject_IsTrue(val);
+           if (istrue == -1)
+               return -1;
+           else if (istrue)
                this->dict->dv_lock = VAR_LOCKED;
            else
                this->dict->dv_lock = 0;
@@ -1199,7 +1202,10 @@
        }
        else
        {
-           if (PyObject_IsTrue(val))
+           int         istrue = PyObject_IsTrue(val);
+           if (istrue == -1)
+               return -1;
+           else if (istrue)
                this->list->lv_lock = VAR_LOCKED;
            else
                this->list->lv_lock = 0;
@@ -1477,7 +1483,10 @@
 
     if (flags & SOPT_BOOL)
     {
-       r = set_option_value_for(key, PyObject_IsTrue(valObject), NULL,
+       int     istrue = PyObject_IsTrue(valObject);
+       if (istrue == -1)
+           return -1;
+       r = set_option_value_for(key, istrue, NULL,
                                opt_flags, this->opt_type, this->from);
     }
     else if (flags & SOPT_NUM)

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


*** /tmp/extdiff.Ozh4bQ/vim.3b5aba648b4a/src/if_py_both.h	2013-05-01 19:13:50.718905299 +0400
--- vim.9a4df126f7c4/src/if_py_both.h	2013-05-01 19:13:50.723905250 +0400
***************
*** 698,704 ****
  	}
  	else
  	{
! 	    if (PyObject_IsTrue(val))
  		this->dict->dv_lock = VAR_LOCKED;
  	    else
  		this->dict->dv_lock = 0;
--- 698,707 ----
  	}
  	else
  	{
! 	    int		istrue = PyObject_IsTrue(val);
! 	    if (istrue == -1)
! 		return -1;
! 	    else if (istrue)
  		this->dict->dv_lock = VAR_LOCKED;
  	    else
  		this->dict->dv_lock = 0;
***************
*** 1199,1205 ****
  	}
  	else
  	{
! 	    if (PyObject_IsTrue(val))
  		this->list->lv_lock = VAR_LOCKED;
  	    else
  		this->list->lv_lock = 0;
--- 1202,1211 ----
  	}
  	else
  	{
! 	    int		istrue = PyObject_IsTrue(val);
! 	    if (istrue == -1)
! 		return -1;
! 	    else if (istrue)
  		this->list->lv_lock = VAR_LOCKED;
  	    else
  		this->list->lv_lock = 0;
***************
*** 1477,1483 ****
  
      if (flags & SOPT_BOOL)
      {
! 	r = set_option_value_for(key, PyObject_IsTrue(valObject), NULL,
  				opt_flags, this->opt_type, this->from);
      }
      else if (flags & SOPT_NUM)
--- 1483,1492 ----
  
      if (flags & SOPT_BOOL)
      {
! 	int	istrue = PyObject_IsTrue(valObject);
! 	if (istrue == -1)
! 	    return -1;
! 	r = set_option_value_for(key, istrue, NULL,
  				opt_flags, this->opt_type, this->from);
      }
      else if (flags & SOPT_NUM)

Raspunde prin e-mail lui