|
Karsten Hopp |
55c909 |
To: vim_dev@googlegroups.com
|
|
Karsten Hopp |
55c909 |
Subject: Patch 7.3.1287
|
|
Karsten Hopp |
55c909 |
Fcc: outbox
|
|
Karsten Hopp |
55c909 |
From: Bram Moolenaar <Bram@moolenaar.net>
|
|
Karsten Hopp |
55c909 |
Mime-Version: 1.0
|
|
Karsten Hopp |
55c909 |
Content-Type: text/plain; charset=UTF-8
|
|
Karsten Hopp |
55c909 |
Content-Transfer-Encoding: 8bit
|
|
Karsten Hopp |
55c909 |
------------
|
|
Karsten Hopp |
55c909 |
|
|
Karsten Hopp |
55c909 |
Patch 7.3.1287
|
|
Karsten Hopp |
55c909 |
Problem: Python SystemExit exception is not handled properly.
|
|
Karsten Hopp |
55c909 |
Solution: Catch the exception and give an error. (Yasuhiro Matsumoto, Ken
|
|
Karsten Hopp |
55c909 |
Takata)
|
|
Karsten Hopp |
55c909 |
Files: runtime/doc/if_pyth.txt, src/if_py_both.h, src/if_python.c,
|
|
Karsten Hopp |
55c909 |
src/if_python3.c
|
|
Karsten Hopp |
55c909 |
|
|
Karsten Hopp |
55c909 |
|
|
Karsten Hopp |
55c909 |
*** ../vim-7.3.1286/runtime/doc/if_pyth.txt 2013-06-12 14:40:58.000000000 +0200
|
|
Karsten Hopp |
55c909 |
--- runtime/doc/if_pyth.txt 2013-07-01 21:56:02.000000000 +0200
|
|
Karsten Hopp |
55c909 |
***************
|
|
Karsten Hopp |
55c909 |
*** 740,745 ****
|
|
Karsten Hopp |
55c909 |
--- 740,750 ----
|
|
Karsten Hopp |
55c909 |
3. You undefine PY_NO_RTLD_GLOBAL in auto/config.h after configuration. This
|
|
Karsten Hopp |
55c909 |
may crash Vim though.
|
|
Karsten Hopp |
55c909 |
|
|
Karsten Hopp |
55c909 |
+ *E880*
|
|
Karsten Hopp |
55c909 |
+ Raising SystemExit exception in python isn't endorsed way to quit vim, use: >
|
|
Karsten Hopp |
55c909 |
+ :py vim.command("qall!")
|
|
Karsten Hopp |
55c909 |
+ <
|
|
Karsten Hopp |
55c909 |
+
|
|
Karsten Hopp |
55c909 |
*has-python*
|
|
Karsten Hopp |
55c909 |
You can test what Python version is available with: >
|
|
Karsten Hopp |
55c909 |
if has('python')
|
|
Karsten Hopp |
55c909 |
*** ../vim-7.3.1286/src/if_py_both.h 2013-06-24 22:33:26.000000000 +0200
|
|
Karsten Hopp |
55c909 |
--- src/if_py_both.h 2013-07-01 22:02:17.000000000 +0200
|
|
Karsten Hopp |
55c909 |
***************
|
|
Karsten Hopp |
55c909 |
*** 13,18 ****
|
|
Karsten Hopp |
55c909 |
--- 13,20 ----
|
|
Karsten Hopp |
55c909 |
* Common code for if_python.c and if_python3.c.
|
|
Karsten Hopp |
55c909 |
*/
|
|
Karsten Hopp |
55c909 |
|
|
Karsten Hopp |
55c909 |
+ static char_u e_py_systemexit[] = "E880: Can't handle SystemExit of %s exception in vim";
|
|
Karsten Hopp |
55c909 |
+
|
|
Karsten Hopp |
55c909 |
#if PY_VERSION_HEX < 0x02050000
|
|
Karsten Hopp |
55c909 |
typedef int Py_ssize_t; /* Python 2.4 and earlier don't have this type. */
|
|
Karsten Hopp |
55c909 |
#endif
|
|
Karsten Hopp |
55c909 |
***************
|
|
Karsten Hopp |
55c909 |
*** 275,281 ****
|
|
Karsten Hopp |
55c909 |
|
|
Karsten Hopp |
55c909 |
if (self)
|
|
Karsten Hopp |
55c909 |
for (method = self->ob_type->tp_methods ; method->ml_name != NULL ; ++method)
|
|
Karsten Hopp |
55c909 |
! if (add_string(ret, (char *) method->ml_name))
|
|
Karsten Hopp |
55c909 |
{
|
|
Karsten Hopp |
55c909 |
Py_DECREF(ret);
|
|
Karsten Hopp |
55c909 |
return NULL;
|
|
Karsten Hopp |
55c909 |
--- 277,283 ----
|
|
Karsten Hopp |
55c909 |
|
|
Karsten Hopp |
55c909 |
if (self)
|
|
Karsten Hopp |
55c909 |
for (method = self->ob_type->tp_methods ; method->ml_name != NULL ; ++method)
|
|
Karsten Hopp |
55c909 |
! if (add_string(ret, (char *)method->ml_name))
|
|
Karsten Hopp |
55c909 |
{
|
|
Karsten Hopp |
55c909 |
Py_DECREF(ret);
|
|
Karsten Hopp |
55c909 |
return NULL;
|
|
Karsten Hopp |
55c909 |
***************
|
|
Karsten Hopp |
55c909 |
*** 549,556 ****
|
|
Karsten Hopp |
55c909 |
VimTryEnd(void)
|
|
Karsten Hopp |
55c909 |
{
|
|
Karsten Hopp |
55c909 |
--trylevel;
|
|
Karsten Hopp |
55c909 |
! /* Without this it stops processing all subsequent VimL commands and
|
|
Karsten Hopp |
55c909 |
! * generates strange error messages if I e.g. try calling Test() in a cycle */
|
|
Karsten Hopp |
55c909 |
did_emsg = FALSE;
|
|
Karsten Hopp |
55c909 |
/* Keyboard interrupt should be preferred over anything else */
|
|
Karsten Hopp |
55c909 |
if (got_int)
|
|
Karsten Hopp |
55c909 |
--- 551,559 ----
|
|
Karsten Hopp |
55c909 |
VimTryEnd(void)
|
|
Karsten Hopp |
55c909 |
{
|
|
Karsten Hopp |
55c909 |
--trylevel;
|
|
Karsten Hopp |
55c909 |
! /* Without this it stops processing all subsequent VimL commands and
|
|
Karsten Hopp |
55c909 |
! * generates strange error messages if I e.g. try calling Test() in a
|
|
Karsten Hopp |
55c909 |
! * cycle */
|
|
Karsten Hopp |
55c909 |
did_emsg = FALSE;
|
|
Karsten Hopp |
55c909 |
/* Keyboard interrupt should be preferred over anything else */
|
|
Karsten Hopp |
55c909 |
if (got_int)
|
|
Karsten Hopp |
55c909 |
***************
|
|
Karsten Hopp |
55c909 |
*** 570,576 ****
|
|
Karsten Hopp |
55c909 |
/* Finally transform VimL exception to python one */
|
|
Karsten Hopp |
55c909 |
else
|
|
Karsten Hopp |
55c909 |
{
|
|
Karsten Hopp |
55c909 |
! PyErr_SetVim((char *) current_exception->value);
|
|
Karsten Hopp |
55c909 |
discard_current_exception();
|
|
Karsten Hopp |
55c909 |
return -1;
|
|
Karsten Hopp |
55c909 |
}
|
|
Karsten Hopp |
55c909 |
--- 573,579 ----
|
|
Karsten Hopp |
55c909 |
/* Finally transform VimL exception to python one */
|
|
Karsten Hopp |
55c909 |
else
|
|
Karsten Hopp |
55c909 |
{
|
|
Karsten Hopp |
55c909 |
! PyErr_SetVim((char *)current_exception->value);
|
|
Karsten Hopp |
55c909 |
discard_current_exception();
|
|
Karsten Hopp |
55c909 |
return -1;
|
|
Karsten Hopp |
55c909 |
}
|
|
Karsten Hopp |
55c909 |
***************
|
|
Karsten Hopp |
55c909 |
*** 667,673 ****
|
|
Karsten Hopp |
55c909 |
|
|
Karsten Hopp |
55c909 |
/* For backwards compatibility numbers are stored as strings. */
|
|
Karsten Hopp |
55c909 |
sprintf(buf, "%ld", (long)our_tv->vval.v_number);
|
|
Karsten Hopp |
55c909 |
! ret = PyString_FromString((char *) buf);
|
|
Karsten Hopp |
55c909 |
}
|
|
Karsten Hopp |
55c909 |
# ifdef FEAT_FLOAT
|
|
Karsten Hopp |
55c909 |
else if (our_tv->v_type == VAR_FLOAT)
|
|
Karsten Hopp |
55c909 |
--- 670,676 ----
|
|
Karsten Hopp |
55c909 |
|
|
Karsten Hopp |
55c909 |
/* For backwards compatibility numbers are stored as strings. */
|
|
Karsten Hopp |
55c909 |
sprintf(buf, "%ld", (long)our_tv->vval.v_number);
|
|
Karsten Hopp |
55c909 |
! ret = PyString_FromString((char *)buf);
|
|
Karsten Hopp |
55c909 |
}
|
|
Karsten Hopp |
55c909 |
# ifdef FEAT_FLOAT
|
|
Karsten Hopp |
55c909 |
else if (our_tv->v_type == VAR_FLOAT)
|
|
Karsten Hopp |
55c909 |
***************
|
|
Karsten Hopp |
55c909 |
*** 675,681 ****
|
|
Karsten Hopp |
55c909 |
char buf[NUMBUFLEN];
|
|
Karsten Hopp |
55c909 |
|
|
Karsten Hopp |
55c909 |
sprintf(buf, "%f", our_tv->vval.v_float);
|
|
Karsten Hopp |
55c909 |
! ret = PyString_FromString((char *) buf);
|
|
Karsten Hopp |
55c909 |
}
|
|
Karsten Hopp |
55c909 |
# endif
|
|
Karsten Hopp |
55c909 |
else if (our_tv->v_type == VAR_LIST)
|
|
Karsten Hopp |
55c909 |
--- 678,684 ----
|
|
Karsten Hopp |
55c909 |
char buf[NUMBUFLEN];
|
|
Karsten Hopp |
55c909 |
|
|
Karsten Hopp |
55c909 |
sprintf(buf, "%f", our_tv->vval.v_float);
|
|
Karsten Hopp |
55c909 |
! ret = PyString_FromString((char *)buf);
|
|
Karsten Hopp |
55c909 |
}
|
|
Karsten Hopp |
55c909 |
# endif
|
|
Karsten Hopp |
55c909 |
else if (our_tv->v_type == VAR_LIST)
|
|
Karsten Hopp |
55c909 |
***************
|
|
Karsten Hopp |
55c909 |
*** 955,961 ****
|
|
Karsten Hopp |
55c909 |
PyObject *pathObject;
|
|
Karsten Hopp |
55c909 |
map_rtp_data *mr_data = *((map_rtp_data **) data);
|
|
Karsten Hopp |
55c909 |
|
|
Karsten Hopp |
55c909 |
! if (!(pathObject = PyString_FromString((char *) path)))
|
|
Karsten Hopp |
55c909 |
{
|
|
Karsten Hopp |
55c909 |
*data = NULL;
|
|
Karsten Hopp |
55c909 |
return;
|
|
Karsten Hopp |
55c909 |
--- 958,964 ----
|
|
Karsten Hopp |
55c909 |
PyObject *pathObject;
|
|
Karsten Hopp |
55c909 |
map_rtp_data *mr_data = *((map_rtp_data **) data);
|
|
Karsten Hopp |
55c909 |
|
|
Karsten Hopp |
55c909 |
! if (!(pathObject = PyString_FromString((char *)path)))
|
|
Karsten Hopp |
55c909 |
{
|
|
Karsten Hopp |
55c909 |
*data = NULL;
|
|
Karsten Hopp |
55c909 |
return;
|
|
Karsten Hopp |
55c909 |
***************
|
|
Karsten Hopp |
55c909 |
*** 1124,1130 ****
|
|
Karsten Hopp |
55c909 |
PyObject *module;
|
|
Karsten Hopp |
55c909 |
char *dot;
|
|
Karsten Hopp |
55c909 |
|
|
Karsten Hopp |
55c909 |
! if ((dot = (char *) vim_strchr((char_u *) tail, '.')))
|
|
Karsten Hopp |
55c909 |
{
|
|
Karsten Hopp |
55c909 |
/*
|
|
Karsten Hopp |
55c909 |
* There is a dot in the name: call find_module recursively without the
|
|
Karsten Hopp |
55c909 |
--- 1127,1133 ----
|
|
Karsten Hopp |
55c909 |
PyObject *module;
|
|
Karsten Hopp |
55c909 |
char *dot;
|
|
Karsten Hopp |
55c909 |
|
|
Karsten Hopp |
55c909 |
! if ((dot = (char *)vim_strchr((char_u *) tail, '.')))
|
|
Karsten Hopp |
55c909 |
{
|
|
Karsten Hopp |
55c909 |
/*
|
|
Karsten Hopp |
55c909 |
* There is a dot in the name: call find_module recursively without the
|
|
Karsten Hopp |
55c909 |
***************
|
|
Karsten Hopp |
55c909 |
*** 1658,1664 ****
|
|
Karsten Hopp |
55c909 |
|
|
Karsten Hopp |
55c909 |
--((*dii)->todo);
|
|
Karsten Hopp |
55c909 |
|
|
Karsten Hopp |
55c909 |
! if (!(ret = PyBytes_FromString((char *) (*dii)->hi->hi_key)))
|
|
Karsten Hopp |
55c909 |
return NULL;
|
|
Karsten Hopp |
55c909 |
|
|
Karsten Hopp |
55c909 |
return ret;
|
|
Karsten Hopp |
55c909 |
--- 1661,1667 ----
|
|
Karsten Hopp |
55c909 |
|
|
Karsten Hopp |
55c909 |
--((*dii)->todo);
|
|
Karsten Hopp |
55c909 |
|
|
Karsten Hopp |
55c909 |
! if (!(ret = PyBytes_FromString((char *)(*dii)->hi->hi_key)))
|
|
Karsten Hopp |
55c909 |
return NULL;
|
|
Karsten Hopp |
55c909 |
|
|
Karsten Hopp |
55c909 |
return ret;
|
|
Karsten Hopp |
55c909 |
***************
|
|
Karsten Hopp |
55c909 |
*** 2680,2691 ****
|
|
Karsten Hopp |
55c909 |
FunctionRepr(FunctionObject *self)
|
|
Karsten Hopp |
55c909 |
{
|
|
Karsten Hopp |
55c909 |
#ifdef Py_TRACE_REFS
|
|
Karsten Hopp |
55c909 |
! /* For unknown reason self->name may be NULL after calling
|
|
Karsten Hopp |
55c909 |
* Finalize */
|
|
Karsten Hopp |
55c909 |
return PyString_FromFormat("<vim.Function '%s'>",
|
|
Karsten Hopp |
55c909 |
! (self->name == NULL ? "<NULL>" : (char *) self->name));
|
|
Karsten Hopp |
55c909 |
#else
|
|
Karsten Hopp |
55c909 |
! return PyString_FromFormat("<vim.Function '%s'>", (char *) self->name);
|
|
Karsten Hopp |
55c909 |
#endif
|
|
Karsten Hopp |
55c909 |
}
|
|
Karsten Hopp |
55c909 |
|
|
Karsten Hopp |
55c909 |
--- 2683,2694 ----
|
|
Karsten Hopp |
55c909 |
FunctionRepr(FunctionObject *self)
|
|
Karsten Hopp |
55c909 |
{
|
|
Karsten Hopp |
55c909 |
#ifdef Py_TRACE_REFS
|
|
Karsten Hopp |
55c909 |
! /* For unknown reason self->name may be NULL after calling
|
|
Karsten Hopp |
55c909 |
* Finalize */
|
|
Karsten Hopp |
55c909 |
return PyString_FromFormat("<vim.Function '%s'>",
|
|
Karsten Hopp |
55c909 |
! (self->name == NULL ? "<NULL>" : (char *)self->name));
|
|
Karsten Hopp |
55c909 |
#else
|
|
Karsten Hopp |
55c909 |
! return PyString_FromFormat("<vim.Function '%s'>", (char *)self->name);
|
|
Karsten Hopp |
55c909 |
#endif
|
|
Karsten Hopp |
55c909 |
}
|
|
Karsten Hopp |
55c909 |
|
|
Karsten Hopp |
55c909 |
***************
|
|
Karsten Hopp |
55c909 |
*** 2809,2815 ****
|
|
Karsten Hopp |
55c909 |
{
|
|
Karsten Hopp |
55c909 |
if (stringval)
|
|
Karsten Hopp |
55c909 |
{
|
|
Karsten Hopp |
55c909 |
! PyObject *ret = PyBytes_FromString((char *) stringval);
|
|
Karsten Hopp |
55c909 |
vim_free(stringval);
|
|
Karsten Hopp |
55c909 |
return ret;
|
|
Karsten Hopp |
55c909 |
}
|
|
Karsten Hopp |
55c909 |
--- 2812,2818 ----
|
|
Karsten Hopp |
55c909 |
{
|
|
Karsten Hopp |
55c909 |
if (stringval)
|
|
Karsten Hopp |
55c909 |
{
|
|
Karsten Hopp |
55c909 |
! PyObject *ret = PyBytes_FromString((char *)stringval);
|
|
Karsten Hopp |
55c909 |
vim_free(stringval);
|
|
Karsten Hopp |
55c909 |
return ret;
|
|
Karsten Hopp |
55c909 |
}
|
|
Karsten Hopp |
55c909 |
***************
|
|
Karsten Hopp |
55c909 |
*** 4525,4531 ****
|
|
Karsten Hopp |
55c909 |
{
|
|
Karsten Hopp |
55c909 |
if (strcmp(name, "name") == 0)
|
|
Karsten Hopp |
55c909 |
return PyString_FromString((self->buf->b_ffname == NULL
|
|
Karsten Hopp |
55c909 |
! ? "" : (char *) self->buf->b_ffname));
|
|
Karsten Hopp |
55c909 |
else if (strcmp(name, "number") == 0)
|
|
Karsten Hopp |
55c909 |
return Py_BuildValue(Py_ssize_t_fmt, self->buf->b_fnum);
|
|
Karsten Hopp |
55c909 |
else if (strcmp(name, "vars") == 0)
|
|
Karsten Hopp |
55c909 |
--- 4528,4534 ----
|
|
Karsten Hopp |
55c909 |
{
|
|
Karsten Hopp |
55c909 |
if (strcmp(name, "name") == 0)
|
|
Karsten Hopp |
55c909 |
return PyString_FromString((self->buf->b_ffname == NULL
|
|
Karsten Hopp |
55c909 |
! ? "" : (char *)self->buf->b_ffname));
|
|
Karsten Hopp |
55c909 |
else if (strcmp(name, "number") == 0)
|
|
Karsten Hopp |
55c909 |
return Py_BuildValue(Py_ssize_t_fmt, self->buf->b_fnum);
|
|
Karsten Hopp |
55c909 |
else if (strcmp(name, "vars") == 0)
|
|
Karsten Hopp |
55c909 |
***************
|
|
Karsten Hopp |
55c909 |
*** 4961,4967 ****
|
|
Karsten Hopp |
55c909 |
#endif
|
|
Karsten Hopp |
55c909 |
)
|
|
Karsten Hopp |
55c909 |
{
|
|
Karsten Hopp |
55c909 |
! PyRun_SimpleString((char *) cmd);
|
|
Karsten Hopp |
55c909 |
}
|
|
Karsten Hopp |
55c909 |
|
|
Karsten Hopp |
55c909 |
static const char *code_hdr = "def " DOPY_FUNC "(line, linenr):\n ";
|
|
Karsten Hopp |
55c909 |
--- 4964,4982 ----
|
|
Karsten Hopp |
55c909 |
#endif
|
|
Karsten Hopp |
55c909 |
)
|
|
Karsten Hopp |
55c909 |
{
|
|
Karsten Hopp |
55c909 |
! PyObject *run_ret;
|
|
Karsten Hopp |
55c909 |
! run_ret = PyRun_String((char *)cmd, Py_file_input, globals, globals);
|
|
Karsten Hopp |
55c909 |
! if (run_ret != NULL)
|
|
Karsten Hopp |
55c909 |
! {
|
|
Karsten Hopp |
55c909 |
! Py_DECREF(run_ret);
|
|
Karsten Hopp |
55c909 |
! }
|
|
Karsten Hopp |
55c909 |
! else if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_SystemExit))
|
|
Karsten Hopp |
55c909 |
! {
|
|
Karsten Hopp |
55c909 |
! EMSG2(_(e_py_systemexit), "python");
|
|
Karsten Hopp |
55c909 |
! PyErr_Clear();
|
|
Karsten Hopp |
55c909 |
! }
|
|
Karsten Hopp |
55c909 |
! else
|
|
Karsten Hopp |
55c909 |
! PyErr_PrintEx(1);
|
|
Karsten Hopp |
55c909 |
}
|
|
Karsten Hopp |
55c909 |
|
|
Karsten Hopp |
55c909 |
static const char *code_hdr = "def " DOPY_FUNC "(line, linenr):\n ";
|
|
Karsten Hopp |
55c909 |
***************
|
|
Karsten Hopp |
55c909 |
*** 4979,4984 ****
|
|
Karsten Hopp |
55c909 |
--- 4994,5000 ----
|
|
Karsten Hopp |
55c909 |
char *code;
|
|
Karsten Hopp |
55c909 |
int status;
|
|
Karsten Hopp |
55c909 |
PyObject *pyfunc, *pymain;
|
|
Karsten Hopp |
55c909 |
+ PyObject *run_ret;
|
|
Karsten Hopp |
55c909 |
|
|
Karsten Hopp |
55c909 |
if (u_save((linenr_T)RangeStart - 1, (linenr_T)RangeEnd + 1) != OK)
|
|
Karsten Hopp |
55c909 |
{
|
|
Karsten Hopp |
55c909 |
***************
|
|
Karsten Hopp |
55c909 |
*** 4990,4996 ****
|
|
Karsten Hopp |
55c909 |
code = PyMem_New(char, len + 1);
|
|
Karsten Hopp |
55c909 |
memcpy(code, code_hdr, code_hdr_len);
|
|
Karsten Hopp |
55c909 |
STRCPY(code + code_hdr_len, cmd);
|
|
Karsten Hopp |
55c909 |
! status = PyRun_SimpleString(code);
|
|
Karsten Hopp |
55c909 |
PyMem_Free(code);
|
|
Karsten Hopp |
55c909 |
|
|
Karsten Hopp |
55c909 |
if (status)
|
|
Karsten Hopp |
55c909 |
--- 5006,5028 ----
|
|
Karsten Hopp |
55c909 |
code = PyMem_New(char, len + 1);
|
|
Karsten Hopp |
55c909 |
memcpy(code, code_hdr, code_hdr_len);
|
|
Karsten Hopp |
55c909 |
STRCPY(code + code_hdr_len, cmd);
|
|
Karsten Hopp |
55c909 |
! run_ret = PyRun_String(code, Py_file_input, globals, globals);
|
|
Karsten Hopp |
55c909 |
! status = -1;
|
|
Karsten Hopp |
55c909 |
! if (run_ret != NULL)
|
|
Karsten Hopp |
55c909 |
! {
|
|
Karsten Hopp |
55c909 |
! status = 0;
|
|
Karsten Hopp |
55c909 |
! Py_DECREF(run_ret);
|
|
Karsten Hopp |
55c909 |
! }
|
|
Karsten Hopp |
55c909 |
! else if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_SystemExit))
|
|
Karsten Hopp |
55c909 |
! {
|
|
Karsten Hopp |
55c909 |
! PyMem_Free(code);
|
|
Karsten Hopp |
55c909 |
! EMSG2(_(e_py_systemexit), "python");
|
|
Karsten Hopp |
55c909 |
! PyErr_Clear();
|
|
Karsten Hopp |
55c909 |
! return;
|
|
Karsten Hopp |
55c909 |
! }
|
|
Karsten Hopp |
55c909 |
! else
|
|
Karsten Hopp |
55c909 |
! PyErr_PrintEx(1);
|
|
Karsten Hopp |
55c909 |
!
|
|
Karsten Hopp |
55c909 |
PyMem_Free(code);
|
|
Karsten Hopp |
55c909 |
|
|
Karsten Hopp |
55c909 |
if (status)
|
|
Karsten Hopp |
55c909 |
***************
|
|
Karsten Hopp |
55c909 |
*** 5068,5076 ****
|
|
Karsten Hopp |
55c909 |
{
|
|
Karsten Hopp |
55c909 |
PyObject *run_ret;
|
|
Karsten Hopp |
55c909 |
|
|
Karsten Hopp |
55c909 |
! run_ret = PyRun_String((char *) cmd, Py_eval_input, globals, globals);
|
|
Karsten Hopp |
55c909 |
if (run_ret == NULL)
|
|
Karsten Hopp |
55c909 |
{
|
|
Karsten Hopp |
55c909 |
if (PyErr_Occurred() && !msg_silent)
|
|
Karsten Hopp |
55c909 |
PyErr_PrintEx(0);
|
|
Karsten Hopp |
55c909 |
EMSG(_("E858: Eval did not return a valid python object"));
|
|
Karsten Hopp |
55c909 |
--- 5100,5113 ----
|
|
Karsten Hopp |
55c909 |
{
|
|
Karsten Hopp |
55c909 |
PyObject *run_ret;
|
|
Karsten Hopp |
55c909 |
|
|
Karsten Hopp |
55c909 |
! run_ret = PyRun_String((char *)cmd, Py_eval_input, globals, globals);
|
|
Karsten Hopp |
55c909 |
if (run_ret == NULL)
|
|
Karsten Hopp |
55c909 |
{
|
|
Karsten Hopp |
55c909 |
+ if (PyErr_ExceptionMatches(PyExc_SystemExit))
|
|
Karsten Hopp |
55c909 |
+ {
|
|
Karsten Hopp |
55c909 |
+ EMSG2(_(e_py_systemexit), "python");
|
|
Karsten Hopp |
55c909 |
+ PyErr_Clear();
|
|
Karsten Hopp |
55c909 |
+ }
|
|
Karsten Hopp |
55c909 |
if (PyErr_Occurred() && !msg_silent)
|
|
Karsten Hopp |
55c909 |
PyErr_PrintEx(0);
|
|
Karsten Hopp |
55c909 |
EMSG(_("E858: Eval did not return a valid python object"));
|
|
Karsten Hopp |
55c909 |
*** ../vim-7.3.1286/src/if_python.c 2013-06-24 20:32:54.000000000 +0200
|
|
Karsten Hopp |
55c909 |
--- src/if_python.c 2013-07-01 21:56:02.000000000 +0200
|
|
Karsten Hopp |
55c909 |
***************
|
|
Karsten Hopp |
55c909 |
*** 444,449 ****
|
|
Karsten Hopp |
55c909 |
--- 444,450 ----
|
|
Karsten Hopp |
55c909 |
static PyObject *imp_PyExc_KeyboardInterrupt;
|
|
Karsten Hopp |
55c909 |
static PyObject *imp_PyExc_TypeError;
|
|
Karsten Hopp |
55c909 |
static PyObject *imp_PyExc_ValueError;
|
|
Karsten Hopp |
55c909 |
+ static PyObject *imp_PyExc_SystemExit;
|
|
Karsten Hopp |
55c909 |
static PyObject *imp_PyExc_RuntimeError;
|
|
Karsten Hopp |
55c909 |
static PyObject *imp_PyExc_ImportError;
|
|
Karsten Hopp |
55c909 |
static PyObject *imp_PyExc_OverflowError;
|
|
Karsten Hopp |
55c909 |
***************
|
|
Karsten Hopp |
55c909 |
*** 454,459 ****
|
|
Karsten Hopp |
55c909 |
--- 455,461 ----
|
|
Karsten Hopp |
55c909 |
# define PyExc_KeyboardInterrupt imp_PyExc_KeyboardInterrupt
|
|
Karsten Hopp |
55c909 |
# define PyExc_TypeError imp_PyExc_TypeError
|
|
Karsten Hopp |
55c909 |
# define PyExc_ValueError imp_PyExc_ValueError
|
|
Karsten Hopp |
55c909 |
+ # define PyExc_SystemExit imp_PyExc_SystemExit
|
|
Karsten Hopp |
55c909 |
# define PyExc_RuntimeError imp_PyExc_RuntimeError
|
|
Karsten Hopp |
55c909 |
# define PyExc_ImportError imp_PyExc_ImportError
|
|
Karsten Hopp |
55c909 |
# define PyExc_OverflowError imp_PyExc_OverflowError
|
|
Karsten Hopp |
55c909 |
***************
|
|
Karsten Hopp |
55c909 |
*** 731,736 ****
|
|
Karsten Hopp |
55c909 |
--- 733,739 ----
|
|
Karsten Hopp |
55c909 |
imp_PyExc_KeyboardInterrupt = PyDict_GetItemString(exdict, "KeyboardInterrupt");
|
|
Karsten Hopp |
55c909 |
imp_PyExc_TypeError = PyDict_GetItemString(exdict, "TypeError");
|
|
Karsten Hopp |
55c909 |
imp_PyExc_ValueError = PyDict_GetItemString(exdict, "ValueError");
|
|
Karsten Hopp |
55c909 |
+ imp_PyExc_SystemExit = PyDict_GetItemString(exdict, "SystemExit");
|
|
Karsten Hopp |
55c909 |
imp_PyExc_RuntimeError = PyDict_GetItemString(exdict, "RuntimeError");
|
|
Karsten Hopp |
55c909 |
imp_PyExc_ImportError = PyDict_GetItemString(exdict, "ImportError");
|
|
Karsten Hopp |
55c909 |
imp_PyExc_OverflowError = PyDict_GetItemString(exdict, "OverflowError");
|
|
Karsten Hopp |
55c909 |
***************
|
|
Karsten Hopp |
55c909 |
*** 740,745 ****
|
|
Karsten Hopp |
55c909 |
--- 743,749 ----
|
|
Karsten Hopp |
55c909 |
Py_XINCREF(imp_PyExc_KeyboardInterrupt);
|
|
Karsten Hopp |
55c909 |
Py_XINCREF(imp_PyExc_TypeError);
|
|
Karsten Hopp |
55c909 |
Py_XINCREF(imp_PyExc_ValueError);
|
|
Karsten Hopp |
55c909 |
+ Py_XINCREF(imp_PyExc_SystemExit);
|
|
Karsten Hopp |
55c909 |
Py_XINCREF(imp_PyExc_RuntimeError);
|
|
Karsten Hopp |
55c909 |
Py_XINCREF(imp_PyExc_ImportError);
|
|
Karsten Hopp |
55c909 |
Py_XINCREF(imp_PyExc_OverflowError);
|
|
Karsten Hopp |
55c909 |
*** ../vim-7.3.1286/src/if_python3.c 2013-06-23 16:35:32.000000000 +0200
|
|
Karsten Hopp |
55c909 |
--- src/if_python3.c 2013-07-01 21:56:02.000000000 +0200
|
|
Karsten Hopp |
55c909 |
***************
|
|
Karsten Hopp |
55c909 |
*** 126,132 ****
|
|
Karsten Hopp |
55c909 |
# define PyErr_PrintEx py3_PyErr_PrintEx
|
|
Karsten Hopp |
55c909 |
# define PyErr_NoMemory py3_PyErr_NoMemory
|
|
Karsten Hopp |
55c909 |
# define PyErr_Occurred py3_PyErr_Occurred
|
|
Karsten Hopp |
55c909 |
- # define PyErr_PrintEx py3_PyErr_PrintEx
|
|
Karsten Hopp |
55c909 |
# define PyErr_SetNone py3_PyErr_SetNone
|
|
Karsten Hopp |
55c909 |
# define PyErr_SetString py3_PyErr_SetString
|
|
Karsten Hopp |
55c909 |
# define PyErr_SetObject py3_PyErr_SetObject
|
|
Karsten Hopp |
55c909 |
--- 126,131 ----
|
|
Karsten Hopp |
55c909 |
***************
|
|
Karsten Hopp |
55c909 |
*** 403,408 ****
|
|
Karsten Hopp |
55c909 |
--- 402,408 ----
|
|
Karsten Hopp |
55c909 |
static PyObject *p3imp_PyExc_KeyboardInterrupt;
|
|
Karsten Hopp |
55c909 |
static PyObject *p3imp_PyExc_TypeError;
|
|
Karsten Hopp |
55c909 |
static PyObject *p3imp_PyExc_ValueError;
|
|
Karsten Hopp |
55c909 |
+ static PyObject *p3imp_PyExc_SystemExit;
|
|
Karsten Hopp |
55c909 |
static PyObject *p3imp_PyExc_RuntimeError;
|
|
Karsten Hopp |
55c909 |
static PyObject *p3imp_PyExc_ImportError;
|
|
Karsten Hopp |
55c909 |
static PyObject *p3imp_PyExc_OverflowError;
|
|
Karsten Hopp |
55c909 |
***************
|
|
Karsten Hopp |
55c909 |
*** 413,418 ****
|
|
Karsten Hopp |
55c909 |
--- 413,419 ----
|
|
Karsten Hopp |
55c909 |
# define PyExc_KeyboardInterrupt p3imp_PyExc_KeyboardInterrupt
|
|
Karsten Hopp |
55c909 |
# define PyExc_TypeError p3imp_PyExc_TypeError
|
|
Karsten Hopp |
55c909 |
# define PyExc_ValueError p3imp_PyExc_ValueError
|
|
Karsten Hopp |
55c909 |
+ # define PyExc_SystemExit p3imp_PyExc_SystemExit
|
|
Karsten Hopp |
55c909 |
# define PyExc_RuntimeError p3imp_PyExc_RuntimeError
|
|
Karsten Hopp |
55c909 |
# define PyExc_ImportError p3imp_PyExc_ImportError
|
|
Karsten Hopp |
55c909 |
# define PyExc_OverflowError p3imp_PyExc_OverflowError
|
|
Karsten Hopp |
55c909 |
***************
|
|
Karsten Hopp |
55c909 |
*** 681,686 ****
|
|
Karsten Hopp |
55c909 |
--- 682,688 ----
|
|
Karsten Hopp |
55c909 |
p3imp_PyExc_KeyboardInterrupt = PyDict_GetItemString(exdict, "KeyboardInterrupt");
|
|
Karsten Hopp |
55c909 |
p3imp_PyExc_TypeError = PyDict_GetItemString(exdict, "TypeError");
|
|
Karsten Hopp |
55c909 |
p3imp_PyExc_ValueError = PyDict_GetItemString(exdict, "ValueError");
|
|
Karsten Hopp |
55c909 |
+ p3imp_PyExc_SystemExit = PyDict_GetItemString(exdict, "SystemExit");
|
|
Karsten Hopp |
55c909 |
p3imp_PyExc_RuntimeError = PyDict_GetItemString(exdict, "RuntimeError");
|
|
Karsten Hopp |
55c909 |
p3imp_PyExc_ImportError = PyDict_GetItemString(exdict, "ImportError");
|
|
Karsten Hopp |
55c909 |
p3imp_PyExc_OverflowError = PyDict_GetItemString(exdict, "OverflowError");
|
|
Karsten Hopp |
55c909 |
***************
|
|
Karsten Hopp |
55c909 |
*** 690,695 ****
|
|
Karsten Hopp |
55c909 |
--- 692,698 ----
|
|
Karsten Hopp |
55c909 |
Py_XINCREF(p3imp_PyExc_KeyboardInterrupt);
|
|
Karsten Hopp |
55c909 |
Py_XINCREF(p3imp_PyExc_TypeError);
|
|
Karsten Hopp |
55c909 |
Py_XINCREF(p3imp_PyExc_ValueError);
|
|
Karsten Hopp |
55c909 |
+ Py_XINCREF(p3imp_PyExc_SystemExit);
|
|
Karsten Hopp |
55c909 |
Py_XINCREF(p3imp_PyExc_RuntimeError);
|
|
Karsten Hopp |
55c909 |
Py_XINCREF(p3imp_PyExc_ImportError);
|
|
Karsten Hopp |
55c909 |
Py_XINCREF(p3imp_PyExc_OverflowError);
|
|
Karsten Hopp |
55c909 |
*** ../vim-7.3.1286/src/version.c 2013-07-01 21:43:05.000000000 +0200
|
|
Karsten Hopp |
55c909 |
--- src/version.c 2013-07-01 21:57:00.000000000 +0200
|
|
Karsten Hopp |
55c909 |
***************
|
|
Karsten Hopp |
55c909 |
*** 730,731 ****
|
|
Karsten Hopp |
55c909 |
--- 730,733 ----
|
|
Karsten Hopp |
55c909 |
{ /* Add new patch number below this line */
|
|
Karsten Hopp |
55c909 |
+ /**/
|
|
Karsten Hopp |
55c909 |
+ 1287,
|
|
Karsten Hopp |
55c909 |
/**/
|
|
Karsten Hopp |
55c909 |
|
|
Karsten Hopp |
55c909 |
--
|
|
Karsten Hopp |
55c909 |
5 out of 4 people have trouble with fractions.
|
|
Karsten Hopp |
55c909 |
|
|
Karsten Hopp |
55c909 |
/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
|
|
Karsten Hopp |
55c909 |
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
|
|
Karsten Hopp |
55c909 |
\\\ an exciting new programming language -- http://www.Zimbu.org ///
|
|
Karsten Hopp |
55c909 |
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
|