summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <bram@vim.org>2013-05-30 13:37:28 +0200
committerBram Moolenaar <bram@vim.org>2013-05-30 13:37:28 +0200
commit3873597ec09ce1571ebfe891fbd04ce7a9200095 (patch)
tree35a771fae3ad64b8c2ecbbe4c337e2e7c1be2337
parent1d73cd7e2a1a47bd003ad919d8e1909155242eea (diff)
downloadvim-7.3.1068.tar.gz
updated for version 7.3.1068v7.3.1068v7-3-1068
Problem: Python: Script is auto-loaded on function creation. Solution: Python patch 27. (ZyX)
-rw-r--r--src/eval.c7
-rw-r--r--src/if_py_both.h16
-rw-r--r--src/proto/eval.pro1
-rw-r--r--src/testdir/test86.ok2
-rw-r--r--src/testdir/test87.ok2
-rw-r--r--src/version.c2
-rw-r--r--src/vim.h3
7 files changed, 14 insertions, 19 deletions
diff --git a/src/eval.c b/src/eval.c
index 06cf4882..83233c9d 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -810,6 +810,7 @@ static int
# endif
prof_self_cmp __ARGS((const void *s1, const void *s2));
#endif
+static int script_autoload __ARGS((char_u *name, int reload));
static char_u *autoload_name __ARGS((char_u *name));
static void cat_func_name __ARGS((char_u *buf, ufunc_T *fp));
static void func_free __ARGS((ufunc_T *fp));
@@ -829,10 +830,6 @@ static int compare_func_name __ARGS((const void *s1, const void *s2));
static void sortFunctions __ARGS(());
#endif
-
-/* Character used as separated in autoload function/variable names. */
-#define AUTOLOAD_CHAR '#'
-
/*
* Initialize the global and v: variables.
*/
@@ -22190,7 +22187,7 @@ prof_self_cmp(s1, s2)
* If "name" has a package name try autoloading the script for it.
* Return TRUE if a package was loaded.
*/
- int
+ static int
script_autoload(name, reload)
char_u *name;
int reload; /* load script again when already loaded */
diff --git a/src/if_py_both.h b/src/if_py_both.h
index e31509cf..5fe04760 100644
--- a/src/if_py_both.h
+++ b/src/if_py_both.h
@@ -2015,19 +2015,13 @@ FunctionNew(PyTypeObject *subtype, char_u *name)
func_ref(self->name);
}
else
- {
- self->name = get_expanded_name(name, TRUE);
- if (self->name == NULL)
+ if ((self->name = get_expanded_name(name,
+ vim_strchr(name, AUTOLOAD_CHAR) == NULL))
+ == NULL)
{
- if (script_autoload(name, TRUE) && !aborting())
- self->name = get_expanded_name(name, TRUE);
- if (self->name == NULL)
- {
- PyErr_SetString(PyExc_ValueError, _("function does not exist"));
- return NULL;
- }
+ PyErr_SetString(PyExc_ValueError, _("function does not exist"));
+ return NULL;
}
- }
return (PyObject *)(self);
}
diff --git a/src/proto/eval.pro b/src/proto/eval.pro
index 56f91bba..3f2816ec 100644
--- a/src/proto/eval.pro
+++ b/src/proto/eval.pro
@@ -132,5 +132,4 @@ void last_set_msg __ARGS((scid_T scriptID));
void ex_oldfiles __ARGS((exarg_T *eap));
int modify_fname __ARGS((char_u *src, int *usedlen, char_u **fnamep, char_u **bufp, int *fnamelen));
char_u *do_string_sub __ARGS((char_u *str, char_u *pat, char_u *sub, char_u *flags));
-int script_autoload __ARGS((char_u *name, int reload));
/* vim: set ft=c : */
diff --git a/src/testdir/test86.ok b/src/testdir/test86.ok
index 452c48fd..048458f9 100644
--- a/src/testdir/test86.ok
+++ b/src/testdir/test86.ok
@@ -889,7 +889,7 @@ l.xxx = True:(<type 'exceptions.AttributeError'>, AttributeError('cannot set thi
>> FunctionConstructor
vim.Function("123"):(<type 'exceptions.ValueError'>, ValueError('unnamed function does not exist',))
vim.Function("xxx_non_existent_function_xxx"):(<type 'exceptions.ValueError'>, ValueError('function does not exist',))
-vim.Function("xxx#non#existent#function#xxx"):(<type 'exceptions.ValueError'>, ValueError('function does not exist',))
+vim.Function("xxx#non#existent#function#xxx"):NOT FAILED
>> FunctionCall
>>> Testing StringToChars using f({%s : 1})
f({1 : 1}):(<type 'exceptions.TypeError'>, TypeError('object must be string',))
diff --git a/src/testdir/test87.ok b/src/testdir/test87.ok
index 7a1f6c90..2d361bb7 100644
--- a/src/testdir/test87.ok
+++ b/src/testdir/test87.ok
@@ -878,7 +878,7 @@ l.xxx = True:(<class 'AttributeError'>, AttributeError('cannot set this attribut
>> FunctionConstructor
vim.Function("123"):(<class 'ValueError'>, ValueError('unnamed function does not exist',))
vim.Function("xxx_non_existent_function_xxx"):(<class 'ValueError'>, ValueError('function does not exist',))
-vim.Function("xxx#non#existent#function#xxx"):(<class 'ValueError'>, ValueError('function does not exist',))
+vim.Function("xxx#non#existent#function#xxx"):NOT FAILED
>> FunctionCall
>>> Testing StringToChars using f({%s : 1})
f({1 : 1}):(<class 'TypeError'>, TypeError('object must be string',))
diff --git a/src/version.c b/src/version.c
index 173f254f..7a1ab6e9 100644
--- a/src/version.c
+++ b/src/version.c
@@ -729,6 +729,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 1068,
+/**/
1067,
/**/
1066,
diff --git a/src/vim.h b/src/vim.h
index 265720ae..5fb0481d 100644
--- a/src/vim.h
+++ b/src/vim.h
@@ -2243,4 +2243,7 @@ typedef int VimClipboard; /* This is required for the prototypes. */
#define SREQ_WIN 1 /* Request window-local option */
#define SREQ_BUF 2 /* Request buffer-local option */
+/* Character used as separated in autoload function/variable names. */
+#define AUTOLOAD_CHAR '#'
+
#endif /* VIM__H */