Skip to content

Commit 77324fc

Browse files
committed
patch 7.4.1129
Problem: Python None value can't be converted to a Vim value. Solution: Just use zero. (Damien)
1 parent 85084ef commit 77324fc

File tree

6 files changed

+9
-1
lines changed

6 files changed

+9
-1
lines changed

src/if_py_both.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5521,7 +5521,7 @@ run_eval(const char *cmd, typval_T *rettv
55215521
}
55225522
else
55235523
{
5524-
if (ConvertFromPyObject(run_ret, rettv) == -1)
5524+
if (run_ret != Py_None && ConvertFromPyObject(run_ret, rettv) == -1)
55255525
EMSG(_("E859: Failed to convert returned python object to vim value"));
55265526
Py_DECREF(run_ret);
55275527
}

src/testdir/test86.in

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,8 @@ EOF
329329
:$put =string(l)
330330
:let d=pyeval('{"a": "b", "c": 1, "d": ["e"]}')
331331
:$put =sort(items(d))
332+
:let v:errmsg = ''
333+
:$put ='pyeval(\"None\") = ' . pyeval('None') . v:errmsg
332334
:if has('float')
333335
: let f=pyeval('0.0')
334336
: $put =string(f)

src/testdir/test86.ok

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ ll:[1]
8686
['a', 'b']
8787
['c', 1]
8888
['d', ['e']]
89+
pyeval("None") = 0
8990
0.0
9091
"\0": Vim(let):E859:
9192
{"\0": 1}: Vim(let):E859:

src/testdir/test87.in

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,8 @@ EOF
326326
:$put =string(l)
327327
:let d=py3eval('{"a": "b", "c": 1, "d": ["e"]}')
328328
:$put =sort(items(d))
329+
:let v:errmsg = ''
330+
:$put ='py3eval(\"None\") = ' . py3eval('None') . v:errmsg
329331
:if has('float')
330332
: let f=py3eval('0.0')
331333
: $put =string(f)

src/testdir/test87.ok

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ ll:[1]
8686
['a', 'b']
8787
['c', 1]
8888
['d', ['e']]
89+
py3eval("None") = 0
8990
0.0
9091
"\0": Vim(let):E859:
9192
{"\0": 1}: Vim(let):E859:

src/version.c

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

742742
static int included_patches[] =
743743
{ /* Add new patch number below this line */
744+
/**/
745+
1129,
744746
/**/
745747
1128,
746748
/**/

0 commit comments

Comments
 (0)