Loading ...
Sorry, an error occurred while loading the content.

[PATCH] (26/27?) Python interface improvements: check whether PyObject_IsTrue failed

Expand Messages
  • ZyX
    # HG changeset patch # User ZyX # Date 1367416122 -14400 # Branch python-extended-2 # Node ID 9a4df126f7c42e0b81df62eba1249300a906f450 # Parent
    Message 1 of 49 , May 1, 2013
    • 0 Attachment
      # HG changeset patch
      # User ZyX <kp-pav@...>
      # 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 vim_dev+unsubscribe@....
      For more options, visit https://groups.google.com/groups/opt_out.
    • ZyX
      ... Because you have problems with encoding somewhere: there were no question marks in the patch, but Russian text. I just was not aware of the strange choice:
      Message 49 of 49 , May 15, 2013
      • 0 Attachment
        > After including this patch the tests were failing. The .ok files had
        > "????" where the test results in "window". I assume those question
        > marks were wrong, so I fixed the .ok files for that. But I wonder why
        > this happened.

        Because you have problems with encoding somewhere: there were no question marks in the patch, but Russian text. I just was not aware of the strange choice: using translated strings in `repr()`. I think translated messages here are just as “good” as translated exceptions; needless to say I have never seen them translated in other projects.

        --
        --
        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 vim_dev+unsubscribe@....
        For more options, visit https://groups.google.com/groups/opt_out.
      Your message has been successfully submitted and would be delivered to recipients shortly.