Problem: Maximum callback depth is not configurable.
Solution: Revert patch 9.0.2103. Set 'maxfuncdepth' in test.
(zeertzjq)
fixes: #13732
closes: #13736
Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
-*message.txt* For Vim version 9.0. Last change: 2023 Nov 08
+*message.txt* For Vim version 9.0. Last change: 2023 Dec 20
VIM REFERENCE MANUAL by Bram Moolenaar
command, etc. The limit is 200 or the value of 'maxfuncdepth', whatever is
larger. When it's more there probably is an endless loop. Probably a
|:execute| or |:source| command is involved.
-Can also happen with a recursive callback function (|job-callback|).
-A limit of 20 is used here.
*E254*
Cannot allocate color {name} ~
-*options.txt* For Vim version 9.0. Last change: 2023 Dec 16
+*options.txt* For Vim version 9.0. Last change: 2023 Dec 20
VIM REFERENCE MANUAL by Bram Moolenaar
Increasing this limit above 200 also changes the maximum for Ex
command recursion, see |E169|.
See also |:function|.
+ Also used for maximum depth of callback functions.
*'maxmapdepth'* *'mmd'* *E223*
'maxmapdepth' 'mmd' number (default 1000)
endfunc
func Test_popup_close_callback_recursive()
+ set maxfuncdepth=20
" this invokes the callback recursively
let winid = popup_create('something', #{callback: 'popup_close'})
redraw
- call assert_fails('call popup_close(winid)', 'E169')
+ call assert_fails('call popup_close(winid)', 'E169:')
+
+ set maxfuncdepth&
endfunc
" vim: shiftwidth=2 sts=2
#include "vim.h"
#if defined(FEAT_EVAL) || defined(PROTO)
-
-#define MAX_CALLBACK_DEPTH 20
-
/*
* All user-defined functions are found in this hashtable.
*/
if (callback->cb_name == NULL || *callback->cb_name == NUL)
return FAIL;
- if (callback_depth > MAX_CALLBACK_DEPTH)
+ if (callback_depth > p_mfd)
{
emsg(_(e_command_too_recursive));
return FAIL;
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 2183,
/**/
2182,
/**/