Mercurial > vim
diff src/if_py_both.h @ 19102:ba9f50bfda83 v8.2.0111
patch 8.2.0111: VAR_SPECIAL is also used for booleans
Commit: https://github.com/vim/vim/commit/9b4a15d5dba354d2e1e02871470bad103f34769a
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Jan 11 16:05:23 2020 +0100
patch 8.2.0111: VAR_SPECIAL is also used for booleans
Problem: VAR_SPECIAL is also used for booleans.
Solution: Add VAR_BOOL for better type checking.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 11 Jan 2020 16:15:04 +0100 |
parents | 75562beba71c |
children | 94eda51ba9ba |
line wrap: on
line diff
--- a/src/if_py_both.h +++ b/src/if_py_both.h @@ -844,23 +844,24 @@ VimToPython(typval_T *our_tv, int depth, } } } - else if (our_tv->v_type == VAR_SPECIAL) + else if (our_tv->v_type == VAR_BOOL) { if (our_tv->vval.v_number == VVAL_FALSE) { ret = Py_False; Py_INCREF(ret); } - else if (our_tv->vval.v_number == VVAL_TRUE) + else { ret = Py_True; Py_INCREF(ret); } - else - { - Py_INCREF(Py_None); - ret = Py_None; - } + return ret; + } + else if (our_tv->v_type == VAR_SPECIAL) + { + Py_INCREF(Py_None); + ret = Py_None; return ret; } else if (our_tv->v_type == VAR_BLOB) @@ -6389,6 +6390,7 @@ ConvertToPyObject(typval_T *tv) case VAR_JOB: Py_INCREF(Py_None); return Py_None; + case VAR_BOOL: case VAR_SPECIAL: switch (tv->vval.v_number) {