patch 9.1.1967: if_python: 64bit numbers truncated

Commit: 
https://github.com/vim/vim/commit/a52b11d05757ee9c056a7f1118e6f7d3c2da9d44
Author: lsq <[email protected]>
Date:   Thu Dec 11 19:59:13 2025 +0100

    patch 9.1.1967: if_python: 64bit numbers truncated
    
    Problem:  if_python: 64bit numbers truncated
    Solution: cast python result to long long (lsq)
    
    fixes:  #18899
    closes: #18904
    
    Signed-off-by: lsq <[email protected]>
    Signed-off-by: Yegappan Lakshmanan <[email protected]>
    Signed-off-by: Christian Brabandt <[email protected]>

diff --git a/src/if_py_both.h b/src/if_py_both.h
index 7fc055db5..e0020519b 100644
--- a/src/if_py_both.h
+++ b/src/if_py_both.h
@@ -1039,7 +1039,7 @@ VimToPython(typval_T *our_tv, int depth, PyObject 
*lookup_dict)
        char buf[NUMBUFLEN];
 
        // For backwards compatibility numbers are stored as strings.
-       sprintf(buf, "%ld", (long)our_tv->vval.v_number);
+       sprintf(buf, "%lld", (long long)our_tv->vval.v_number);
        ret = PyString_FromString((char *)buf);
     }
     else if (our_tv->v_type == VAR_FLOAT)
diff --git a/src/testdir/test_python3.vim b/src/testdir/test_python3.vim
index 3cc5ff2d9..8fc62d699 100644
--- a/src/testdir/test_python3.vim
+++ b/src/testdir/test_python3.vim
@@ -305,7 +305,12 @@ endfunc
 
 " Test vim.eval() with various types.
 func Test_python3_vim_eval()
-  call assert_equal("
8",             execute('py3 print(vim.eval("3+5"))'))
+  call assert_equal("
2061300532912", execute('py3 print(vim.eval("2061300532912"))'))
+  call assert_equal("
9223372036854775807", execute('py3 print(vim.eval("9223372036854775807"))'))
+  call assert_equal("
-9223372036854775807",execute('py3 print(vim.eval("-9223372036854775807"))'))
+  call assert_equal("
2147483648",  execute('py3 print(vim.eval("2147483648"))'))
+  call assert_equal("
-2147483649", execute('py3 print(vim.eval("-2147483649"))'))
+  call assert_equal("
8",           execute('py3 print(vim.eval("3+5"))'))
   call assert_equal("
3.140000",    execute('py3 print(vim.eval("1.01+2.13"))'))
   call assert_equal("
0.000000",    execute('py3 print(vim.eval("0.0/(1.0/0.0)"))'))
   call assert_equal("
0.000000",    execute('py3 print(vim.eval("0.0/(1.0/0.0)"))'))
diff --git a/src/version.c b/src/version.c
index 9e5cfdcd5..e02438312 100644
--- a/src/version.c
+++ b/src/version.c
@@ -729,6 +729,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1967,
 /**/
     1966,
 /**/

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/vim_dev/E1vTmMf-00AD5E-5g%40256bit.org.

Raspunde prin e-mail lui