patch 8.1.0950: using :python sets 'pyxversion' even when not executed

Problem:    Using :python sets 'pyxversion' even when not executed.
Solution:   Check the "skip" flag. (Shane Harper, closes #3995)
diff --git a/src/if_python.c b/src/if_python.c
index 06c46bc..c0a3fe1 100644
--- a/src/if_python.c
+++ b/src/if_python.c
@@ -1109,12 +1109,12 @@
 {
     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 8b4bee9..3c6ee15 100644
--- a/src/if_python3.c
+++ b/src/if_python3.c
@@ -1010,12 +1010,12 @@
 {
     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 d79400d..43c89c9 100644
--- a/src/testdir/test_python2.vim
+++ b/src/testdir/test_python2.vim
@@ -63,3 +63,11 @@
   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 344034a..272ff9e 100644
--- a/src/testdir/test_python3.vim
+++ b/src/testdir/test_python3.vim
@@ -63,3 +63,11 @@
   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 32abc71..fe498ec 100644
--- a/src/version.c
+++ b/src/version.c
@@ -780,6 +780,8 @@
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    950,
+/**/
     949,
 /**/
     948,