To: vim_dev@googlegroups.com Subject: Patch 7.3.825 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 7.3.825 Problem: With Python errors are not always clear. Solution: Print the stack trace, unless :silent is used. (ZyX) Files: src/if_python3.c, src/if_python.c *** ../vim-7.3.824/src/if_python3.c 2013-02-13 14:17:00.000000000 +0100 --- src/if_python3.c 2013-02-20 15:26:03.000000000 +0100 *************** *** 122,127 **** --- 122,128 ---- # 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,284 **** --- 280,286 ---- 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,408 **** --- 405,411 ---- {"_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}, *************** *** 842,848 **** --- 845,855 ---- 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) *** ../vim-7.3.824/src/if_python.c 2013-02-13 14:17:00.000000000 +0100 --- src/if_python.c 2013-02-20 15:26:03.000000000 +0100 *************** *** 148,153 **** --- 148,154 ---- # 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,256 **** --- 252,258 ---- 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,385 **** --- 382,388 ---- {"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}, *************** *** 856,862 **** --- 859,869 ---- 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) *** ../vim-7.3.824/src/version.c 2013-02-20 15:19:38.000000000 +0100 --- src/version.c 2013-02-20 15:27:20.000000000 +0100 *************** *** 727,728 **** --- 727,730 ---- { /* Add new patch number below this line */ + /**/ + 825, /**/ -- ARTHUR: What are you going to do. bleed on me? "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD /// Bram Moolenaar -- Bram@Moolenaar.net -- 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 ///