diff options
author | Bram Moolenaar <Bram@vim.org> | 2020-01-11 16:05:23 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2020-01-11 16:05:23 +0100 |
commit | 9b4a15d5dba354d2e1e02871470bad103f34769a (patch) | |
tree | e5e49ad3182e07e641cdea0e04c4a8078186c58c /src/if_py_both.h | |
parent | e05a89ac6399a8c7d164c99fdab6841d999a9128 (diff) | |
download | vim-git-9b4a15d5dba354d2e1e02871470bad103f34769a.tar.gz |
patch 8.2.0111: VAR_SPECIAL is also used for booleansv8.2.0111
Problem: VAR_SPECIAL is also used for booleans.
Solution: Add VAR_BOOL for better type checking.
Diffstat (limited to 'src/if_py_both.h')
-rw-r--r-- | src/if_py_both.h | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/if_py_both.h b/src/if_py_both.h index d81638655..af4b98dd0 100644 --- a/src/if_py_both.h +++ b/src/if_py_both.h @@ -844,23 +844,24 @@ VimToPython(typval_T *our_tv, int depth, PyObject *lookup_dict) } } } - 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) { |