Skip to content

Commit 14816ad

Browse files
committed
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)
1 parent 0472b6d commit 14816ad

5 files changed

Lines changed: 24 additions & 6 deletions

File tree

src/if_python.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1109,12 +1109,12 @@ ex_python(exarg_T *eap)
11091109
{
11101110
char_u *script;
11111111

1112-
if (p_pyx == 0)
1113-
p_pyx = 2;
1114-
11151112
script = script_get(eap, eap->arg);
11161113
if (!eap->skip)
11171114
{
1115+
if (p_pyx == 0)
1116+
p_pyx = 2;
1117+
11181118
DoPyCommand(script == NULL ? (char *) eap->arg : (char *) script,
11191119
(rangeinitializer) init_range_cmd,
11201120
(runner) run_cmd,

src/if_python3.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1010,12 +1010,12 @@ ex_py3(exarg_T *eap)
10101010
{
10111011
char_u *script;
10121012

1013-
if (p_pyx == 0)
1014-
p_pyx = 3;
1015-
10161013
script = script_get(eap, eap->arg);
10171014
if (!eap->skip)
10181015
{
1016+
if (p_pyx == 0)
1017+
p_pyx = 3;
1018+
10191019
DoPyCommand(script == NULL ? (char *) eap->arg : (char *) script,
10201020
(rangeinitializer) init_range_cmd,
10211021
(runner) run_cmd,

src/testdir/test_python2.vim

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,3 +63,11 @@ func Test_vim_function()
6363
py del f
6464
delfunc s:foo
6565
endfunc
66+
67+
func Test_skipped_python_command_does_not_affect_pyxversion()
68+
set pyxversion=0
69+
if 0
70+
python import vim
71+
endif
72+
call assert_equal(0, &pyxversion) " This assertion would have failed with Vim 8.0.0251. (pyxversion was introduced in 8.0.0251.)
73+
endfunc

src/testdir/test_python3.vim

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,3 +63,11 @@ func Test_vim_function()
6363
py3 del f
6464
delfunc s:foo
6565
endfunc
66+
67+
func Test_skipped_python3_command_does_not_affect_pyxversion()
68+
set pyxversion=0
69+
if 0
70+
python3 import vim
71+
endif
72+
call assert_equal(0, &pyxversion) " This assertion would have failed with Vim 8.0.0251. (pyxversion was introduced in 8.0.0251.)
73+
endfunc

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -779,6 +779,8 @@ static char *(features[]) =
779779

780780
static int included_patches[] =
781781
{ /* Add new patch number below this line */
782+
/**/
783+
950,
782784
/**/
783785
949,
784786
/**/

0 commit comments

Comments
 (0)