1
0
forked from aniani/vim

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)
This commit is contained in:
Bram Moolenaar
2019-02-18 22:04:56 +01:00
parent 0472b6d149
commit 14816ad6e5
5 changed files with 24 additions and 6 deletions

View File

@@ -1109,12 +1109,12 @@ ex_python(exarg_T *eap)
{ {
char_u *script; char_u *script;
if (p_pyx == 0)
p_pyx = 2;
script = script_get(eap, eap->arg); script = script_get(eap, eap->arg);
if (!eap->skip) if (!eap->skip)
{ {
if (p_pyx == 0)
p_pyx = 2;
DoPyCommand(script == NULL ? (char *) eap->arg : (char *) script, DoPyCommand(script == NULL ? (char *) eap->arg : (char *) script,
(rangeinitializer) init_range_cmd, (rangeinitializer) init_range_cmd,
(runner) run_cmd, (runner) run_cmd,

View File

@@ -1010,12 +1010,12 @@ ex_py3(exarg_T *eap)
{ {
char_u *script; char_u *script;
if (p_pyx == 0)
p_pyx = 3;
script = script_get(eap, eap->arg); script = script_get(eap, eap->arg);
if (!eap->skip) if (!eap->skip)
{ {
if (p_pyx == 0)
p_pyx = 3;
DoPyCommand(script == NULL ? (char *) eap->arg : (char *) script, DoPyCommand(script == NULL ? (char *) eap->arg : (char *) script,
(rangeinitializer) init_range_cmd, (rangeinitializer) init_range_cmd,
(runner) run_cmd, (runner) run_cmd,

View File

@@ -63,3 +63,11 @@ func Test_vim_function()
py del f py del f
delfunc s:foo delfunc s:foo
endfunc 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

View File

@@ -63,3 +63,11 @@ func Test_vim_function()
py3 del f py3 del f
delfunc s:foo delfunc s:foo
endfunc 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

View File

@@ -779,6 +779,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
950,
/**/ /**/
949, 949,
/**/ /**/