summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-02-18 22:04:56 +0100
committerBram Moolenaar <Bram@vim.org>2019-02-18 22:04:56 +0100
commit14816ad6e58336773443f5ee2e4aa9e384af65d2 (patch)
treef53327ad0ffed33997cf4bbe9ce4725cb2221980
parent0472b6d149445579e3a63519b15f099f9adda3f7 (diff)
patch 8.1.0950: using :python sets 'pyxversion' even when not executedv8.1.0950
Problem: Using :python sets 'pyxversion' even when not executed. Solution: Check the "skip" flag. (Shane Harper, closes #3995)
-rw-r--r--src/if_python.c6
-rw-r--r--src/if_python3.c6
-rw-r--r--src/testdir/test_python2.vim8
-rw-r--r--src/testdir/test_python3.vim8
-rw-r--r--src/version.c2
5 files changed, 24 insertions, 6 deletions
diff --git a/src/if_python.c b/src/if_python.c
index 06c46bc37b..c0a3fe1055 100644
--- a/src/if_python.c
+++ b/src/if_python.c
@@ -1109,12 +1109,12 @@ ex_python(exarg_T *eap)
{
char_u *script;
- if (p_pyx == 0)
- p_pyx = 2;
-
script = script_get(eap, eap->arg);
if (!eap->skip)
{
+ if (p_pyx == 0)
+ p_pyx = 2;
+
DoPyCommand(script == NULL ? (char *) eap->arg : (char *) script,
(rangeinitializer) init_range_cmd,
(runner) run_cmd,
diff --git a/src/if_python3.c b/src/if_python3.c
index 8b4bee9f75..3c6ee15e3c 100644
--- a/src/if_python3.c
+++ b/src/if_python3.c
@@ -1010,12 +1010,12 @@ ex_py3(exarg_T *eap)
{
char_u *script;
- if (p_pyx == 0)
- p_pyx = 3;
-
script = script_get(eap, eap->arg);
if (!eap->skip)
{
+ if (p_pyx == 0)
+ p_pyx = 3;
+
DoPyCommand(script == NULL ? (char *) eap->arg : (char *) script,
(rangeinitializer) init_range_cmd,
(runner) run_cmd,
diff --git a/src/testdir/test_python2.vim b/src/testdir/test_python2.vim
index d79400de71..43c89c972a 100644
--- a/src/testdir/test_python2.vim
+++ b/src/testdir/test_python2.vim
@@ -63,3 +63,11 @@ func Test_vim_function()
py del f
delfunc s:foo
endfunc
+
+func Test_skipped_python_command_does_not_affect_pyxversion()
+ set pyxversion=0
+ if 0
+ python import vim
+ endif
+ call assert_equal(0, &pyxversion) " This assertion would have failed with Vim 8.0.0251. (pyxversion was introduced in 8.0.0251.)
+endfunc
diff --git a/src/testdir/test_python3.vim b/src/testdir/test_python3.vim
index 344034af00..272ff9ef85 100644
--- a/src/testdir/test_python3.vim
+++ b/src/testdir/test_python3.vim
@@ -63,3 +63,11 @@ func Test_vim_function()
py3 del f
delfunc s:foo
endfunc
+
+func Test_skipped_python3_command_does_not_affect_pyxversion()
+ set pyxversion=0
+ if 0
+ python3 import vim
+ endif
+ call assert_equal(0, &pyxversion) " This assertion would have failed with Vim 8.0.0251. (pyxversion was introduced in 8.0.0251.)
+endfunc
diff --git a/src/version.c b/src/version.c
index 32abc71b01..fe498ecf51 100644
--- a/src/version.c
+++ b/src/version.c
@@ -780,6 +780,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 950,
+/**/
949,
/**/
948,