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

[PATCH] Make pyeval() print st ack traces (unless :silence’d)

Expand Messages
  • ZyX
    # HG changeset patch # User ZyX # Date 1358006430 -14400 # Node ID 9c4ad944627dc19bd898174c8fe28a5ee0de4c26 # Parent
    Message 1 of 4 , Jan 12, 2013
      # HG changeset patch
      # User ZyX <kp-pav@...>
      # Date 1358006430 -14400
      # Node ID 9c4ad944627dc19bd898174c8fe28a5ee0de4c26
      # Parent b89e2bdcc6e516d7e8cbcb3ece9961ffe18b45fa
      Made pyeval()/py3eval() also print error messages

      diff -r b89e2bdcc6e5 -r 9c4ad944627d src/if_python.c
      --- a/src/if_python.c Sun Dec 16 12:50:40 2012 +0100
      +++ b/src/if_python.c Sat Jan 12 20:00:30 2013 +0400
      @@ -148,6 +148,7 @@
      # define PyDict_SetItemString dll_PyDict_SetItemString
      # define PyErr_BadArgument dll_PyErr_BadArgument
      # define PyErr_Clear dll_PyErr_Clear
      +# define PyErr_PrintEx dll_PyErr_PrintEx
      # define PyErr_NoMemory dll_PyErr_NoMemory
      # define PyErr_Occurred dll_PyErr_Occurred
      # define PyErr_SetNone dll_PyErr_SetNone
      @@ -251,6 +252,7 @@
      static int(*dll_PyDict_SetItemString)(PyObject *dp, char *key, PyObject *item);
      static int(*dll_PyErr_BadArgument)(void);
      static void(*dll_PyErr_Clear)(void);
      +static void(*dll_PyErr_PrintEx)(int);
      static PyObject*(*dll_PyErr_NoMemory)(void);
      static PyObject*(*dll_PyErr_Occurred)(void);
      static void(*dll_PyErr_SetNone)(PyObject *);
      @@ -380,6 +382,7 @@
      {"PyDict_SetItemString", (PYTHON_PROC*)&dll_PyDict_SetItemString},
      {"PyErr_BadArgument", (PYTHON_PROC*)&dll_PyErr_BadArgument},
      {"PyErr_Clear", (PYTHON_PROC*)&dll_PyErr_Clear},
      + {"PyErr_PrintEx", (PYTHON_PROC*)&dll_PyErr_PrintEx},
      {"PyErr_NoMemory", (PYTHON_PROC*)&dll_PyErr_NoMemory},
      {"PyErr_Occurred", (PYTHON_PROC*)&dll_PyErr_Occurred},
      {"PyErr_SetNone", (PYTHON_PROC*)&dll_PyErr_SetNone},
      @@ -851,7 +854,11 @@

      r = PyRun_String((char *)(cmd), Py_eval_input, globals, globals);
      if (r == NULL)
      + {
      + if (PyErr_Occurred() && !msg_silent)
      + PyErr_PrintEx(0);
      EMSG(_("E858: Eval did not return a valid python object"));
      + }
      else
      {
      if (ConvertFromPyObject(r, rettv) == -1)
      diff -r b89e2bdcc6e5 -r 9c4ad944627d src/if_python3.c
      --- a/src/if_python3.c Sun Dec 16 12:50:40 2012 +0100
      +++ b/src/if_python3.c Sat Jan 12 20:00:30 2013 +0400
      @@ -122,6 +122,7 @@
      # define PyDict_SetItemString py3_PyDict_SetItemString
      # define PyErr_BadArgument py3_PyErr_BadArgument
      # define PyErr_Clear py3_PyErr_Clear
      +# define PyErr_PrintEx py3_PyErr_PrintEx
      # define PyErr_NoMemory py3_PyErr_NoMemory
      # define PyErr_Occurred py3_PyErr_Occurred
      # define PyErr_SetNone py3_PyErr_SetNone
      @@ -279,6 +280,7 @@
      static void* (*py3_PyMem_Malloc)(size_t);
      static int (*py3_Py_IsInitialized)(void);
      static void (*py3_PyErr_Clear)(void);
      +static void (*py3_PyErr_PrintEx)(int);
      static PyObject*(*py3__PyObject_Init)(PyObject *, PyTypeObject *);
      static iternextfunc py3__PyObject_NextNotImplemented;
      static PyObject* py3__Py_NoneStruct;
      @@ -403,6 +405,7 @@
      {"_Py_FalseStruct", (PYTHON_PROC*)&py3__Py_FalseStruct},
      {"_Py_TrueStruct", (PYTHON_PROC*)&py3__Py_TrueStruct},
      {"PyErr_Clear", (PYTHON_PROC*)&py3_PyErr_Clear},
      + {"PyErr_PrintEx", (PYTHON_PROC*)&py3_PyErr_PrintEx},
      {"PyObject_Init", (PYTHON_PROC*)&py3__PyObject_Init},
      {"PyModule_AddObject", (PYTHON_PROC*)&py3_PyModule_AddObject},
      {"PyImport_AppendInittab", (PYTHON_PROC*)&py3_PyImport_AppendInittab},
      @@ -843,7 +846,11 @@
      r = PyRun_String(PyBytes_AsString(cmdbytes), Py_eval_input,
      globals, globals);
      if (r == NULL)
      + {
      + if (PyErr_Occurred() && !msg_silent)
      + PyErr_PrintEx(0);
      EMSG(_("E860: Eval did not return a valid python 3 object"));
      + }
      else
      {
      if (ConvertFromPyObject(r, rettv) == -1)

      --
      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
    • ZyX
      Wondering what’s the status of this patch? I don’t see it in most recent todo.txt. It would be very fine to include as debugging code that uses `pyeval()
      Message 2 of 4 , Jan 20, 2013
        Wondering what’s the status of this patch? I don’t see it in most recent todo.txt.

        It would be very fine to include as debugging code that uses `pyeval()' is hard without it (did not create before because for my projects using `vim.bindeval' seems to be easier).

        --
        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
      • Bram Moolenaar
        ... It s in the todo list, at line 102 currently. -- You got to work at a mill? Lucky! I got sent back to work in the acid-mines for my daily crust of stale
        Message 3 of 4 , Jan 21, 2013
          ZyX wrote:

          > Wondering what’s the status of this patch? I don’t see it in
          > most recent todo.txt.
          >
          > It would be very fine to include as debugging code that uses
          > `pyeval()' is hard without it (did not create before because for my
          > projects using `vim.bindeval' seems to be easier).

          It's in the todo list, at line 102 currently.

          --
          You got to work at a mill? Lucky! I got sent back to work in the
          acid-mines for my daily crust of stale bread... which not even the
          birds would eat.

          /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
          /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
          \\\ an exciting new programming language -- http://www.Zimbu.org ///
          \\\ help me help AIDS victims -- http://ICCF-Holland.org ///

          --
          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
        • Christian Brabandt
          ... Your version does not seem to have made it into the public available repository yet: http://code.google.com/p/vim/source/browse/runtime/doc/todo.txt#102
          Message 4 of 4 , Jan 22, 2013
            On Mon, January 21, 2013 21:06, Bram Moolenaar wrote:
            >
            > ZyX wrote:
            >
            >> Wondering what’s the status of this patch? I don’t see it in
            >> most recent todo.txt.
            >>
            >> It would be very fine to include as debugging code that uses
            >> `pyeval()' is hard without it (did not create before because for my
            >> projects using `vim.bindeval' seems to be easier).
            >
            > It's in the todo list, at line 102 currently.

            Your version does not seem to have made it into the public
            available repository yet:
            http://code.google.com/p/vim/source/browse/runtime/doc/todo.txt#102

            regards,
            Christian

            --
            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
          Your message has been successfully submitted and would be delivered to recipients shortly.