]> granicus.if.org Git - vim/commitdiff
patch 8.1.0950: using :python sets 'pyxversion' even when not executed v8.1.0950
authorBram Moolenaar <Bram@vim.org>
Mon, 18 Feb 2019 21:04:56 +0000 (22:04 +0100)
committerBram Moolenaar <Bram@vim.org>
Mon, 18 Feb 2019 21:04:56 +0000 (22:04 +0100)
Problem:    Using :python sets 'pyxversion' even when not executed.
Solution:   Check the "skip" flag. (Shane Harper, closes #3995)

src/if_python.c
src/if_python3.c
src/testdir/test_python2.vim
src/testdir/test_python3.vim
src/version.c

index 06c46bc37bdc8bee38c203d7784b9e453309b8b0..c0a3fe1055c788b00ea0724ea35e72d578a4a36c 100644 (file)
@@ -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,
index 8b4bee9f7516924d169680d8a5c4432465e30415..3c6ee15e3c6b96582e950e194ca96f59e9717a3b 100644 (file)
@@ -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,
index d79400de714b55f8c0128a762ca44ac4b481891e..43c89c972a548996a3f27dabff8dd5e012908258 100644 (file)
@@ -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
index 344034af0049434141ef71a2a6aa0e0f11b21092..272ff9ef85db3635f4be9d8d7d1cffb5ebb5902d 100644 (file)
@@ -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
index 32abc71b01f764315ef39b3e439c787b35b8629f..fe498ecf51beca19ce3ceaff93e8d89fe007f06f 100644 (file)
@@ -779,6 +779,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    950,
 /**/
     949,
 /**/