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

[PATCH] (9/?) Python interface improvements: replace Py_BuildValue with PyLong_FromLong

Expand Messages
  • ZyX
    # HG changeset patch # User ZyX # Date 1366994569 -14400 # Branch python-extended-2 # Node ID 9ad3778f7284550c7dff2792f284ceea1e9c7bf1 # Parent
    Message 1 of 49 , Apr 26, 2013
    • 0 Attachment
      # HG changeset patch
      # User ZyX <kp-pav@...>
      # Date 1366994569 -14400
      # Branch python-extended-2
      # Node ID 9ad3778f7284550c7dff2792f284ceea1e9c7bf1
      # Parent 4f40c3dc35eaf077a6154a41fa55eacb0a3a3616
      Remove useless Py_BuildValue calls

      Direct use of PyLong_FromLong should be faster

      diff -r 4f40c3dc35ea -r 9ad3778f7284 src/if_py_both.h
      --- a/src/if_py_both.h Fri Apr 26 21:02:06 2013 +0400
      +++ b/src/if_py_both.h Fri Apr 26 20:42:49 2013 +0400
      @@ -1838,10 +1838,10 @@
      return Py_BuildValue("(ll)", (long)(pos->lnum), (long)(pos->col));
      }
      else if (strcmp(name, "height") == 0)
      - return Py_BuildValue("l", (long)(this->win->w_height));
      + return PyLong_FromLong((long)(this->win->w_height));
      #ifdef FEAT_VERTSPLIT
      else if (strcmp(name, "width") == 0)
      - return Py_BuildValue("l", (long)(W_WIDTH(this->win)));
      + return PyLong_FromLong((long)(W_WIDTH(this->win)));
      #endif
      else if (strcmp(name, "vars") == 0)
      return DictionaryNew(this->win->w_vars);

      --
      --
      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.