Compile warning -Wmaybe-uninitialized about xxd (in gcc 13.2.1) for all featuresets of Vim

2023-10-06 Fir de Conversatie Tony Mechelynck
cd xxd; CC="gcc" CFLAGS=" -O2 -fno-strength-reduce -Wall
-Wno-deprecated-declarations -D_REENTRANT -U_FORTIFY_SOURCE
-D_FORTIFY_SOURCE=1" LDFLAGS="-L/usr/local/lib -Wl,--as-needed" \
make -f Makefile
make[1]: Entering directory '/root/.build/vim/vim-hg/src/shadow-tiny/xxd'
gcc  -O2 -fno-strength-reduce -Wall -Wno-deprecated-declarations
-D_REENTRANT -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -L/usr/local/lib
-Wl,--as-needed -DUNIX -o xxd xxd.c
In function ‘huntype’,
inlined from ‘main’ at xxd.c:919:16:
xxd.c:427:18: warning: ‘bt’ may be used uninitialized [-Wmaybe-uninitialized]
  427 |   if (bt < 0)
  |  ^
xxd.c: In function ‘main’:
xxd.c:367:55: note: ‘bt’ was declared here
  367 |   int c, ign_garb = 1, n1 = -1, n2 = 0, n3, p = cols, bt, b =
0, bcnt = 0;
  |   ^~
make[1]: Leaving directory '/root/.build/vim/vim-hg/src/shadow-tiny/xxd'


Best regards,
Tony.

-- 
-- 
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 vim_dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/CAJkCKXu7yktniKuaz0Uv-JTwvvxdFicvoSnWk0zpkrAp%3DTNUSg%40mail.gmail.com.


Commit: patch 9.0.1998: xxd: cannot reverse a bit dump

2023-10-06 Fir de Conversatie Christian Brabandt
patch 9.0.1998: xxd: cannot reverse a bit dump

Commit: 
https://github.com/vim/vim/commit/85f4521808dd9a587c00f9a2927e84217721cfca
Author: tristhaus 
Date:   Fri Oct 6 19:51:13 2023 +0200

patch 9.0.1998: xxd: cannot reverse a bit dump

Problem:  xxd: cannot reverse a bit dump
Solution: implement reversing the bit dump using -b -r

closes: #13286

Signed-off-by: Christian Brabandt 
Co-authored-by: tristhaus 

diff --git a/runtime/doc/xxd-fr.1 b/runtime/doc/xxd-fr.1
index e170df5d7..7aa3ff1a6 100644
--- a/runtime/doc/xxd-fr.1
+++ b/runtime/doc/xxd-fr.1
@@ -70,7 +70,7 @@ Convertit en binaires plut
 Cette option écrit les octets comme une séquence de "1" et de "0" au lieu
 d'une conversion en hexadécimal traditionnel. Chaque ligne est précédée par un
 numéro de ligne en hexadécimal et suivie de la représentation ASCII (ou
-EBCDIC) correspondante. Les options \-r, \-p, \-i ne fonctionnent pas dans ce
+EBCDIC) correspondante. Les options \-p, \-i ne fonctionnent pas dans ce
 mode.
 .TP
 .IR "\-c cols " | " \-cols cols"
diff --git a/runtime/doc/xxd-fr.UTF-8.1 b/runtime/doc/xxd-fr.UTF-8.1
index 47773a136..9c4c4c928 100644
--- a/runtime/doc/xxd-fr.UTF-8.1
+++ b/runtime/doc/xxd-fr.UTF-8.1
@@ -70,7 +70,7 @@ Convertit en binaires plutôt qu'en hexadécimal.
 Cette option écrit les octets comme une séquence de "1" et de "0" au lieu
 d'une conversion en hexadécimal traditionnel. Chaque ligne est précédée 
par un
 numéro de ligne en hexadécimal et suivie de la représentation ASCII (ou
-EBCDIC) correspondante. Les options \-r, \-p, \-i ne fonctionnent pas dans ce
+EBCDIC) correspondante. Les options \-p, \-i ne fonctionnent pas dans ce
 mode.
 .TP
 .IR "\-c cols " | " \-cols cols"
diff --git a/runtime/doc/xxd-it.1 b/runtime/doc/xxd-it.1
index 9034fddc3..ed4fd8194 100644
--- a/runtime/doc/xxd-it.1
+++ b/runtime/doc/xxd-it.1
@@ -63,7 +63,7 @@ Richiesta di omissione: Un singolo '*' rimpiazza righe a zeri 
binari. Default: o
 Richiesta di un'immagine binaria (cifre binarie), invece che esadecimale.
 Quest'opzione scrive un byte come otto cifre "1" e "0" invece di usare i
 numeri esadecimali. Ogni riga è preceduta da un indirizzo in esadecimale e
-seguita da una decodifica ASCII (o EBCDIC). Le opzioni \-r, \-p, \-i,
+seguita da una decodifica ASCII (o EBCDIC). Le opzioni \-p, \-i,
 specificabili dalla riga comando, non funzionano in questo modo.
 .TP
 .IR "\-c colonne " | " \-cols colonne"
diff --git a/runtime/doc/xxd-it.UTF-8.1 b/runtime/doc/xxd-it.UTF-8.1
index b982a2c9d..8653de972 100644
--- a/runtime/doc/xxd-it.UTF-8.1
+++ b/runtime/doc/xxd-it.UTF-8.1
@@ -63,7 +63,7 @@ Richiesta di omissione: Un singolo '*' rimpiazza righe a zeri 
binari. Default: o
 Richiesta di un'immagine binaria (cifre binarie), invece che esadecimale.
 Quest'opzione scrive un byte come otto cifre "1" e "0" invece di usare i
 numeri esadecimali. Ogni riga è preceduta da un indirizzo in esadecimale e
-seguita da una decodifica ASCII (o EBCDIC). Le opzioni \-r, \-p, \-i,
+seguita da una decodifica ASCII (o EBCDIC). Le opzioni \-p, \-i,
 specificabili dalla riga comando, non funzionano in questo modo.
 .TP
 .IR "\-c colonne " | " \-cols colonne"
diff --git a/runtime/doc/xxd-ja.UTF-8.1 b/runtime/doc/xxd-ja.UTF-8.1
index a03671cb1..1e06bde81 100644
--- a/runtime/doc/xxd-ja.UTF-8.1
+++ b/runtime/doc/xxd-ja.UTF-8.1
@@ -58,7 +58,7 @@
 1 オクテット㠌 "1" 㠨 "0" 㠮 8 文字㠧出力㠕れ㠾㠙。
 å „è¡Œã ®è¡Œé ­ã «ã ¯ 16 é€²æ•°ã ®è¡Œç•ªå ·ã Œè¡¨ç¤ºã •ã‚Œã ¾ã ™ã€‚
 行末㠫㠯 ascii (㠾㠟㠯 ebcdic) ã §è¡¨ã —ã Ÿå ´å ˆã ®æ–‡å­—ã Œè¡¨ç¤ºã 
•ã‚Œã ¾ã ™ã€‚
-㠓㠮モード㠧㠯 \-r〠\-p〠\-i 㠯機能㠗㠾㠛ん。
+㠓㠮モード㠧㠯 \-p〠\-i 㠯機能㠗㠾㠛ん。
 .TP
 .IR \-e
 リトルエンディアン㠮 16 進ダンプ㠫切り替㠈る。
diff --git a/runtime/doc/xxd-pl.1 b/runtime/doc/xxd-pl.1
index d9fa9be20..877b7e45f 100644
--- a/runtime/doc/xxd-pl.1
+++ b/runtime/doc/xxd-pl.1
@@ -66,7 +66,7 @@ Prze
 Opcja ta zapisuje oktety jako osiem cyfr 1 lub 0 zamiast normalnego
 zrzutu heksowego. Ka¿da linia jest poprzedzona przez
 heksadecymalny numer linii a po nim jego reprezentacj± w ascii (lub
-ebcdic). Opcje linii poleceñ \-r, \-p, \-i nie dzia³aj± w tym
+ebcdic). Opcje linii poleceñ \-p, \-i nie dzia³aj± w tym
 trybie.
 .TP
 .IR "\-c cols " | " \-cols cols"
diff --git a/runtime/doc/xxd-pl.UTF-8.1 b/runtime/doc/xxd-pl.UTF-8.1
index e63ce64b7..a28dd6377 100644
--- a/runtime/doc/xxd-pl.UTF-8.1
+++ b/runtime/doc/xxd-pl.UTF-8.1
@@ -66,7 +66,7 @@ Przełącza do zrzutu bitowego (cyfr binarnych) zamiast 
heksowego.
 Opcja ta zapisuje oktety jako osiem cyfr 1 lub 0 zamiast normalnego
 zrzutu heksowego. Każda linia jest poprzedzona przez
 heksadecymalny numer linii a po nim jego reprezentacjÄ… w ascii (lub
-ebcdic). Opcje linii poleceń \-r, \-p, \-i nie działają w tym
+ebcdic). Opcje linii poleceń \-p, \-i nie działają w tym
 trybie.
 .TP
 .IR "\-c cols " | " \-cols cols"
diff --git a/runtime

Commit: runtime(sh): Update ftplugin (#13213)

2023-10-06 Fir de Conversatie Christian Brabandt
runtime(sh): Update ftplugin (#13213)

Commit: 
https://github.com/vim/vim/commit/2a281ccca017fb5e8ffd20a86aa390431224a2fd
Author: dkearns 
Date:   Sat Oct 7 04:59:42 2023 +1100

runtime(sh): Update ftplugin (https://github.com/vim/vim/issues/13213)

Rename 'keywordprg' user command to ShKeywordPrg as this is just a
leaking implementation detail.

Signed-off-by: Christian Brabandt 

diff --git a/runtime/ftplugin/sh.vim b/runtime/ftplugin/sh.vim
index c227838d1..c1a6bc5ad 100644
--- a/runtime/ftplugin/sh.vim
+++ b/runtime/ftplugin/sh.vim
@@ -3,7 +3,8 @@
 " Maintainer:  Doug Kearns 
 " Previous Maintainer: Dan Sharp
 " Contributor: Enno Nagel 
-" Last Change: 2023 Aug 29
+"  Eisuke Kawashima
+" Last Change: 2023 Sep 28
 
 if exists("b:did_ftplugin")
   finish
@@ -39,16 +40,16 @@ if (has("gui_win32") || has("gui_gtk")) && 
!exists("b:browsefilter")
   let b:undo_ftplugin ..= " | unlet! b:browsefilter"
 endif
 
-if (exists("b:is_bash") && (b:is_bash == 1))
+if get(b:, "is_bash", 0)
   if !has("gui_running") && executable("less")
-command! -buffer -nargs=1 Help silent exe '!bash -c "{ help "" 
2>/dev/null || man ""; } | LESS= less"' | redraw!
-  elseif has('terminal')
-command! -buffer -nargs=1 Help silent exe ':term bash -c "help "" 
2>/dev/null || man """'
+command! -buffer -nargs=1 ShKeywordPrg silent exe '!bash -c "{ help 
"" 2>/dev/null || man ""; } | LESS= less"' | redraw!
+  elseif has("terminal")
+command! -buffer -nargs=1 ShKeywordPrg silent exe ':term bash -c "help 
"" 2>/dev/null || man """'
   else
-command! -buffer -nargs=1 Help echo system('bash -c "help " 
2>/dev/null || man ""')
+command! -buffer -nargs=1 ShKeywordPrg echo system('bash -c "help " 
2>/dev/null || man ""')
   endif
-  setlocal keywordprg=:Help
-  let b:undo_ftplugin ..= " | setl kp< | sil! delc -buffer Help"
+  setlocal keywordprg=:ShKeywordPrg
+  let b:undo_ftplugin ..= " | setl kp< | sil! delc -buffer ShKeywordPrg"
 endif
 
 let &cpo = s:save_cpo

-- 
-- 
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 vim_dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/E1qop7Q-00AreZ-Fk%40256bit.org.


Commit: patch 9.0.1999: Vim9: some error messages can be improved

2023-10-06 Fir de Conversatie Christian Brabandt
patch 9.0.1999: Vim9: some error messages can be improved

Commit: 
https://github.com/vim/vim/commit/e6c9aa5e6a88d539a412a9b5526f41ea101aa185
Author: Ernie Rael 
Date:   Fri Oct 6 19:55:52 2023 +0200

patch 9.0.1999: Vim9: some error messages can be improved

Problem:  Vim9: some error messages can be improved
Solution: Mention the defining class for variable access error message

closes: #13272

Signed-off-by: Christian Brabandt 
Signed-off-by: Yegappan Lakshmanan 
Co-authored-by: Ernie Rael 

diff --git a/src/eval.c b/src/eval.c
index a9f7112f2..d9fbec234 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -1105,26 +1105,28 @@ get_lval_check_access(
 #endif
 if (cl_exec == NULL || cl_exec != cl)
 {
+   char *msg = NULL;
switch (om->ocm_access)
{
case VIM_ACCESS_PRIVATE:
-   semsg(_(e_cannot_access_private_variable_str),
-   om->ocm_name, cl->class_name);
-   return FAIL;
+   msg = e_cannot_access_private_variable_str;
+   break;
case VIM_ACCESS_READ:
// If [idx] or .key following, read only OK.
if (*p == '[' || *p == '.')
break;
if ((flags & GLV_READ_ONLY) == 0)
-   {
-   semsg(_(e_variable_is_not_writable_str),
-   om->ocm_name, cl->class_name);
-   return FAIL;
-   }
+   msg = e_variable_is_not_writable_str;
break;
case VIM_ACCESS_ALL:
break;
}
+   if (msg != NULL)
+   {
+   emsg_var_cl_define(msg, om->ocm_name, 0, cl);
+   return FAIL;
+   }
+
 }
 return OK;
 }
diff --git a/src/proto/vim9class.pro b/src/proto/vim9class.pro
index f2e642ec7..e36c7e288 100644
--- a/src/proto/vim9class.pro
+++ b/src/proto/vim9class.pro
@@ -16,6 +16,7 @@ ocmember_T *object_member_lookup(class_T *cl, char_u *name, 
size_t namelen, int
 int object_method_idx(class_T *cl, char_u *name, size_t namelen);
 ufunc_T *object_method_lookup(class_T *cl, char_u *name, size_t namelen, int 
*idx);
 ocmember_T *member_lookup(class_T *cl, vartype_T v_type, char_u *name, size_t 
namelen, int *idx);
+void emsg_var_cl_define(char *msg, char_u *name, size_t len, class_T *cl);
 ufunc_T *method_lookup(class_T *cl, vartype_T v_type, char_u *name, size_t 
namelen, int *idx);
 int inside_class(cctx_T *cctx_arg, class_T *cl);
 void copy_object(typval_T *from, typval_T *to);
diff --git a/src/testdir/test_vim9_class.vim b/src/testdir/test_vim9_class.vim
index dc539aca4..0c8fd7057 100644
--- a/src/testdir/test_vim9_class.vim
+++ b/src/testdir/test_vim9_class.vim
@@ -1725,6 +1725,119 @@ def Test_class_member()
   v9.CheckSourceFailure(lines, 'E1326: Variable not found on object "A": bar', 
5)
 enddef
 
+" These messages should show the defining class of the variable (base class),
+" not the class that did the reference (super class)
+def Test_defining_class_message()
+  var lines =<< trim END
+vim9script
+
+class Base
+  this._v1: list>
+endclass
+
+class Child extends Base
+endclass
+
+var o = Child.new()
+var x = o._v1
+  END
+  v9.CheckSourceFailure(lines, 'E1333: Cannot access private variable "_v1" in 
class "Base"', 11)
+  lines =<< trim END
+vim9script
+
+class Base
+  this._v1: list>
+endclass
+
+class Child extends Base
+endclass
+
+def F()
+  var o = Child.new()
+  var x = o._v1
+enddef
+F()
+  END
+  v9.CheckSourceFailure(lines, 'E1333: Cannot access private variable "_v1" in 
class "Base"', 2)
+  lines =<< trim END
+vim9script
+
+class Base
+  this.v1: list>
+endclass
+
+class Child extends Base
+endclass
+
+var o = Child.new()
+o.v1 = []
+  END
+  v9.CheckSourceFailure(lines, 'E1335: Variable "v1" in class "Base" is not 
writable', 11)
+  lines =<< trim END
+vim9script
+
+class Base
+  this.v1: list>
+endclass
+
+class Child extends Base
+endclass
+
+def F()
+  var o = Child.new()
+  o.v1 = []
+enddef
+F()
+  END
+
+  # Attempt to read a private variable that is in the middle
+  # of the class hierarchy.
+  v9.CheckSourceFailure(lines, 'E1335: Variable "v1" in class "Base" is not 
writable', 2)
+  lines =<< trim END
+vim9script
+
+class Base0
+endclass
+
+class Base extends Base0
+  this._v1: list>
+endclass
+
+class Child extends Base
+endclass
+
+def F()
+  var o = Child.new()
+  var x = o._v1
+enddef
+F()
+  END
+  v9.CheckSourceFailure(lines, 'E1333: Cannot access private variable "_v1" in 
class "Base"', 2)
+
+  # Attempt to read a private variable that is at the start
+  # of the class hierarchy.
+  lines =<< trim END
+vim9script
+
+class Base0
+endclass
+
+class Base extends B

Commit: runtime(doc): remove E1520 tag (#13289)

2023-10-06 Fir de Conversatie Christian Brabandt
runtime(doc): remove E1520 tag (#13289)

Commit: 
https://github.com/vim/vim/commit/27e12c7669e36a8f60fefa9db9a08024efeb06e8
Author: zeertzjq 
Date:   Sat Oct 7 01:34:04 2023 +0800

runtime(doc): remove E1520 tag (https://github.com/vim/vim/issues/13289)

Signed-off-by: Christian Brabandt 

diff --git a/runtime/doc/builtin.txt b/runtime/doc/builtin.txt
index a4eb95e44..029c08bbd 100644
--- a/runtime/doc/builtin.txt
+++ b/runtime/doc/builtin.txt
@@ -6690,8 +6690,6 @@ printf({fmt}, {expr1} ...)
*printf()*
precision, the argument(s) to be used must also be specified
using a {n$} positional argument specifier. See |printf-$|.
 
-
-   *E1520*
The conversion specifiers and their meanings are:
 
*printf-d* *printf-b* *printf-B* *printf-o*
@@ -6885,11 +6883,11 @@ printf({fmt}, {expr1} ...)  
*printf()*
%1$d at width %2$d is: %01$*2$.3$d
 
*E1507*
-   This internal error indicates that the logic to
-   parse a positional format error ran into a problem
-   that couldn't be otherwise reported. Please file a
-   bug against vim if you run into this, copying the
-   exact format string and parameters that were used.
+   This internal error indicates that the logic to parse a
+   positional format argument ran into a problem that couldn't be
+   otherwise reported.  Please file a bug against Vim if you run
+   into this, copying the exact format string and parameters that
+   were used.
 
 
 prompt_getprompt({buf})
*prompt_getprompt()*
diff --git a/runtime/doc/tags b/runtime/doc/tags
index ca4eaf904..77b7d1b2d 100644
--- a/runtime/doc/tags
+++ b/runtime/doc/tags
@@ -4515,7 +4515,6 @@ E1508 editing.txt /*E1508*
 E1509  editing.txt /*E1509*
 E151   helphelp.txt/*E151*
 E152   helphelp.txt/*E152*
-E1520  builtin.txt /*E1520*
 E153   helphelp.txt/*E153*
 E154   helphelp.txt/*E154*
 E155   sign.txt/*E155*

-- 
-- 
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 vim_dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/E1qoosq-00AqW8-RI%40256bit.org.


Commit: patch 9.0.1997: Some unused code in move.c and string.c

2023-10-06 Fir de Conversatie Christian Brabandt
patch 9.0.1997: Some unused code in move.c and string.c

Commit: 
https://github.com/vim/vim/commit/580c1fcb4ad85360cd3a361c3c8e37b534153d60
Author: dundargoc 
Date:   Fri Oct 6 19:41:14 2023 +0200

patch 9.0.1997: Some unused code in move.c and string.c

Problem:  Some unused code in move.c and string.c
Solution: Remove it

closes: #13288

Signed-off-by: Christian Brabandt 
Co-authored-by: dundargoc 

diff --git a/src/move.c b/src/move.c
index 46e4f358d..a0d3a6014 100644
--- a/src/move.c
+++ b/src/move.c
@@ -1753,10 +1753,7 @@ scrolldown(
++row;
}
if (col > width2 && width2 > 0)
-   {
row += col / width2;
-   col = col % width2;
-   }
if (row >= curwin->w_height)
{
curwin->w_curswant = curwin->w_virtcol
@@ -1989,10 +1986,7 @@ adjust_skipcol(void)
++row;
 }
 if (col > width2)
-{
row += col / width2;
-   col = col % width2;
-}
 if (row >= curwin->w_height)
 {
if (curwin->w_skipcol == 0)
diff --git a/src/strings.c b/src/strings.c
index 33616d609..c04cbe84f 100644
--- a/src/strings.c
+++ b/src/strings.c
@@ -2596,7 +2596,7 @@ parse_fmt_types(
CHECK_POS_ARG;
}
}
-   else if (VIM_ISDIGIT((int)(*(arg = p
+   else if (VIM_ISDIGIT((int)(*p)))
{
// size_t could be wider than unsigned int; make sure we treat
// argument like common implementations do
@@ -2651,7 +2651,7 @@ parse_fmt_types(
CHECK_POS_ARG;
}
}
-   else if (VIM_ISDIGIT((int)(*(arg = p
+   else if (VIM_ISDIGIT((int)(*p)))
{
// size_t could be wider than unsigned int; make sure we
// treat argument like common implementations do
@@ -2684,7 +2684,7 @@ parse_fmt_types(
if (length_modifier == 'l' && *p == 'l')
{
// double l = __int64 / varnumber_T
-   length_modifier = 'L';
+   // length_modifier = 'L';
p++;
}
}
diff --git a/src/version.c b/src/version.c
index ec25a1213..a946279ec 100644
--- a/src/version.c
+++ b/src/version.c
@@ -704,6 +704,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+1997,
 /**/
 1996,
 /**/

-- 
-- 
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 vim_dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/E1qoosr-00AqWf-Jl%40256bit.org.


Commit: patch 9.0.1996: Cannot build with python312

2023-10-06 Fir de Conversatie Christian Brabandt
patch 9.0.1996: Cannot build with python312

Commit: 
https://github.com/vim/vim/commit/fa145f200966e47e11c403520374d6d37cfd1de7
Author: Ken Takata 
Date:   Fri Oct 6 19:27:13 2023 +0200

patch 9.0.1996: Cannot build with python312

Problem:  Cannot build with python312
Solution: Define wrapper types and functions for python 3.12

Py_SIZE() uses PyLong_Type and PyBool_Type starting from Python 3.12.
We need to define our own Py_SIZE() to replace Py{Bool,Long}_Type with
py3_Py{Bool,Long}_Type.
We also need to redefine PyTuple_GET_SIZE() and PyList_GET_SIZE(), because
they use Py_SIZE().

closes: #13281
closes: #13290

Signed-off-by: Christian Brabandt 
Co-authored-by: Ken Takata 

diff --git a/src/if_python3.c b/src/if_python3.c
index bbbebc39f..52027bd56 100644
--- a/src/if_python3.c
+++ b/src/if_python3.c
@@ -68,8 +68,6 @@
 #endif
 
 #define PY_SSIZE_T_CLEAN
-#define PyLong_Type (*py3_PyLong_Type)
-#define PyBool_Type (*py3_PyBool_Type)
 
 #ifdef Py_LIMITED_API
 # define USE_LIMITED_API // Using Python 3 limited ABI
@@ -297,6 +295,10 @@ static HINSTANCE hinstPy3 = 0; // Instance of python.dll
 # define PyFloat_Type (*py3_PyFloat_Type)
 # define PyNumber_Check (*py3_PyNumber_Check)
 # define PyNumber_Long (*py3_PyNumber_Long)
+# define PyBool_Type (*py3_PyBool_Type)
+# if PY_VERSION_HEX >= 0x030c00b0
+#  define PyLong_Type (*py3_PyLong_Type)
+# endif
 # define PyErr_NewException py3_PyErr_NewException
 # ifdef Py_DEBUG
 #  define _Py_NegativeRefcount py3__Py_NegativeRefcount
@@ -496,9 +498,9 @@ static PyTypeObject* py3_PyStdPrinter_Type;
 # endif
 static PyTypeObject* py3_PySlice_Type;
 static PyTypeObject* py3_PyFloat_Type;
-PyTypeObject* py3_PyBool_Type;
+static PyTypeObject* py3_PyBool_Type;
 # if PY_VERSION_HEX >= 0x030c00b0
-PyTypeObject* py3_PyLong_Type;
+static PyTypeObject* py3_PyLong_Type;
 # endif
 static int (*py3_PyNumber_Check)(PyObject *);
 static PyObject* (*py3_PyNumber_Long)(PyObject *);
@@ -696,8 +698,9 @@ static struct
 # endif
 {"PySlice_Type", (PYTHON_PROC*)&py3_PySlice_Type},
 {"PyFloat_Type", (PYTHON_PROC*)&py3_PyFloat_Type},
-# if PY_VERSION_HEX < 0x030c00b0
 {"PyBool_Type", (PYTHON_PROC*)&py3_PyBool_Type},
+# if PY_VERSION_HEX >= 0x030c00b0
+{"PyLong_Type", (PYTHON_PROC*)&py3_PyLong_Type},
 # endif
 {"PyNumber_Check", (PYTHON_PROC*)&py3_PyNumber_Check},
 {"PyNumber_Long", (PYTHON_PROC*)&py3_PyNumber_Long},
@@ -789,6 +792,42 @@ py3__PyObject_TypeCheck(PyObject *ob, PyTypeObject *type)
 #  endif
 # endif
 
+# if !defined(USE_LIMITED_API) && PY_VERSION_HEX >= 0x030c00b0
+// Py_SIZE() uses PyLong_Type and PyBool_Type starting from Python 3.12.
+// We need to define our own Py_SIZE() to replace Py{Bool,Long}_Type with
+// py3_Py{Bool,Long}_Type.
+// We also need to redefine PyTuple_GET_SIZE() and PyList_GET_SIZE(), because
+// they use Py_SIZE().
+static inline Py_ssize_t
+py3_Py_SIZE(PyObject *ob)
+{
+assert(ob->ob_type != &PyLong_Type);
+assert(ob->ob_type != &PyBool_Type);
+PyVarObject *var_ob = _PyVarObject_CAST(ob);
+return var_ob->ob_size;
+}
+#  undef Py_SIZE
+#  define Py_SIZE(ob) py3_Py_SIZE(_PyObject_CAST(ob))
+
+static inline Py_ssize_t
+py3_PyTuple_GET_SIZE(PyObject *op)
+{
+PyTupleObject *tuple = _PyTuple_CAST(op);
+return Py_SIZE(tuple);
+}
+#  undef PyTuple_GET_SIZE
+#  define PyTuple_GET_SIZE(op) py3_PyTuple_GET_SIZE(_PyObject_CAST(op))
+
+static inline
+Py_ssize_t py3_PyList_GET_SIZE(PyObject *op)
+{
+PyListObject *list = _PyList_CAST(op);
+return Py_SIZE(list);
+}
+#  undef PyList_GET_SIZE
+#  define PyList_GET_SIZE(op) py3_PyList_GET_SIZE(_PyObject_CAST(op))
+# endif
+
 # ifdef MSWIN
 /*
  * Look up the library "libname" using the InstallPath registry key.
diff --git a/src/version.c b/src/version.c
index ce13dcc77..ec25a1213 100644
--- a/src/version.c
+++ b/src/version.c
@@ -704,6 +704,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+1996,
 /**/
 1995,
 /**/

-- 
-- 
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 vim_dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/E1qoosp-00AqVO-BI%40256bit.org.


Commit: runtime(doc): Update vim9class help (#13292)

2023-10-06 Fir de Conversatie Christian Brabandt
runtime(doc): Update vim9class help (#13292)

Commit: 
https://github.com/vim/vim/commit/26e8f7b0ab451e76319d113038c86c79488bbbc4
Author: Yegappan Lakshmanan <4298407+yegap...@users.noreply.github.com>
Date:   Fri Oct 6 10:24:10 2023 -0700

runtime(doc): Update vim9class help 
(https://github.com/vim/vim/issues/13292)

Signed-off-by: Christian Brabandt 

diff --git a/runtime/doc/vim9class.txt b/runtime/doc/vim9class.txt
index 3e5493f20..00bdf369e 100644
--- a/runtime/doc/vim9class.txt
+++ b/runtime/doc/vim9class.txt
@@ -413,7 +413,9 @@ prefix when defining the method: >
*E1373*
 A class extending the abstract class must implement all the abstract methods.
 The signature (arguments, argument types and return type) must be exactly the
-same.  Class methods in an abstract class can also be abstract methods.
+same.  If the return type of a method is a class, then that class or one of
+its subclasses can be used in the extended method.  Class methods in an
+abstract class can also be abstract methods.
 
 ==
 
@@ -548,8 +550,10 @@ is not possible to override them (unlike some other 
languages).
 
*E1356* *E1357* *E1358*
 Object methods of the base class can be overruled.  The signature (arguments,
-argument types and return type) must be exactly the same.  The method of the
-base class can be called by prefixing "super.".
+argument types and return type) must be exactly the same.  If the return type
+of a method is a class, then that class or one of its subclasses can be used
+in the extended method.  The method of the base class can be called by
+prefixing "super.".
 
*E1377*
 The access level of a method (public or private) in a child class should be
@@ -738,17 +742,19 @@ constructor methods.
 
 7.  Type definition*Vim9-type* *:type*
 
+{not implemented yet}
+
 A type definition is giving a name to a type specification.  For Example: >
 
:type ListOfStrings list
 
-TODO: more explanation
-
 
 ==
 
 8.  Enum   *Vim9-enum* *:enum* *:endenum*
 
+{not implemented yet}
+
 An enum is a type that can have one of a list of values.  Example: >
 
:enum Color
@@ -759,8 +765,6 @@ An enum is a type that can have one of a list of values.  
Example: >
Black
:endenum
 
-TODO: more explanation
-
 
 ==
 

-- 
-- 
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 vim_dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/E1qooeP-00ApUS-Mo%40256bit.org.


Commit: patch 9.0.1995: Invalid memory access with empty 'foldexpr'

2023-10-06 Fir de Conversatie Christian Brabandt
patch 9.0.1995: Invalid memory access with empty 'foldexpr'

Commit: 
https://github.com/vim/vim/commit/a991ce9c083bb8c02b1b1ec34ed35728197050f3
Author: zeertzjq 
Date:   Fri Oct 6 19:16:36 2023 +0200

patch 9.0.1995: Invalid memory access with empty 'foldexpr'

Problem:  Invalid memory access when 'foldexpr' returns empty string.
Solution: Check for NUL.

closes: #13293

Signed-off-by: Christian Brabandt 
Co-authored-by: zeertzjq 

diff --git a/src/eval.c b/src/eval.c
index 19ab01561..a9f7112f2 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -968,7 +968,7 @@ eval_foldexpr(win_T *wp, int *cp)
// If the result is a string, check if there is a non-digit before
// the number.
s = tv.vval.v_string;
-   if (!VIM_ISDIGIT(*s) && *s != '-')
+   if (*s != NUL && !VIM_ISDIGIT(*s) && *s != '-')
*cp = *s++;
retval = atol((char *)s);
}
diff --git a/src/testdir/test_fold.vim b/src/testdir/test_fold.vim
index 398a0c2d7..cb29d43d5 100644
--- a/src/testdir/test_fold.vim
+++ b/src/testdir/test_fold.vim
@@ -1769,4 +1769,13 @@ func Test_foldcolumn_linebreak_control_char()
   bwipe!
 endfunc
 
+" This used to cause invalid memory access
+func Test_foldexpr_return_empty_string()
+  new
+  setlocal foldexpr='' foldmethod=expr
+  redraw
+
+  bwipe!
+endfunc
+
 " vim: shiftwidth=2 sts=2 expandtab
diff --git a/src/version.c b/src/version.c
index 057cae580..ce13dcc77 100644
--- a/src/version.c
+++ b/src/version.c
@@ -704,6 +704,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+1995,
 /**/
 1994,
 /**/

-- 
-- 
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 vim_dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/E1qooeO-00ApTw-9V%40256bit.org.