vim-patch:9.0.2183: Maximum callback depth is not configurable (#26703)

Problem:  Maximum callback depth is not configurable.
Solution: Revert patch 9.0.2103.  Set 'maxfuncdepth' in test.

fixes: vim/vim#13732
closes: vim/vim#13736

fe583b1e59
This commit is contained in:
zeertzjq 2023-12-22 10:33:34 +08:00 committed by GitHub
parent 2b3d1e1854
commit 6700127b30
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 4 additions and 5 deletions

View File

@ -127,8 +127,6 @@ This happens when an Ex command executes an Ex command that executes an Ex
command, etc. The limit is 200 or the value of 'maxfuncdepth', whatever is 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 larger. When it's more there probably is an endless loop. Probably a
|:execute| or |:source| command is involved. |:execute| or |:source| command is involved.
Can also happen with a recursive callback function (|channel-callback|).
A limit of 20 is used here.
*E254* > *E254* >
Cannot allocate color {name} Cannot allocate color {name}

View File

@ -4027,6 +4027,7 @@ A jump table for the options with a short description can be found at |Q_op|.
Increasing this limit above 200 also changes the maximum for Ex Increasing this limit above 200 also changes the maximum for Ex
command recursion, see |E169|. command recursion, see |E169|.
See also |:function|. See also |:function|.
Also used for maximum depth of callback functions.
*'maxmapdepth'* *'mmd'* *E223* *'maxmapdepth'* *'mmd'* *E223*
'maxmapdepth' 'mmd' number (default 1000) 'maxmapdepth' 'mmd' number (default 1000)

View File

@ -4037,6 +4037,7 @@ vim.go.mat = vim.go.matchtime
--- Increasing this limit above 200 also changes the maximum for Ex --- Increasing this limit above 200 also changes the maximum for Ex
--- command recursion, see `E169`. --- command recursion, see `E169`.
--- See also `:function`. --- See also `:function`.
--- Also used for maximum depth of callback functions.
--- ---
--- @type integer --- @type integer
vim.o.maxfuncdepth = 100 vim.o.maxfuncdepth = 100

View File

@ -89,8 +89,6 @@
#define DICT_MAXNEST 100 // maximum nesting of lists and dicts #define DICT_MAXNEST 100 // maximum nesting of lists and dicts
#define MAX_CALLBACK_DEPTH 20
static const char *e_missbrac = N_("E111: Missing ']'"); static const char *e_missbrac = N_("E111: Missing ']'");
static const char *e_list_end = N_("E697: Missing end of List ']': %s"); static const char *e_list_end = N_("E697: Missing end of List ']': %s");
static const char e_cannot_slice_dictionary[] static const char e_cannot_slice_dictionary[]
@ -6061,7 +6059,7 @@ bool callback_call(Callback *const callback, const int argcount_in, typval_T *co
typval_T *const rettv) typval_T *const rettv)
FUNC_ATTR_NONNULL_ALL FUNC_ATTR_NONNULL_ALL
{ {
if (callback_depth > MAX_CALLBACK_DEPTH) { if (callback_depth > p_mfd) {
emsg(_(e_command_too_recursive)); emsg(_(e_command_too_recursive));
return false; return false;
} }

View File

@ -5158,6 +5158,7 @@ return {
Increasing this limit above 200 also changes the maximum for Ex Increasing this limit above 200 also changes the maximum for Ex
command recursion, see |E169|. command recursion, see |E169|.
See also |:function|. See also |:function|.
Also used for maximum depth of callback functions.
]=], ]=],
full_name = 'maxfuncdepth', full_name = 'maxfuncdepth',
scope = { 'global' }, scope = { 'global' },