diff options
author | Sean Dewar <seandewar@users.noreply.github.com> | 2022-08-30 23:13:52 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-30 23:13:52 +0100 |
commit | 813476bf7291dfaf9fc0ef77c9f53a07258a3801 (patch) | |
tree | d31ff4fa8f0b214f03172ec0473c1a22b8ed0139 /src/nvim/api/vimscript.c | |
parent | 6b7eed1884c3b022cc15568c39f80f8f4da0780b (diff) | |
download | rneovim-813476bf7291dfaf9fc0ef77c9f53a07258a3801.tar.gz rneovim-813476bf7291dfaf9fc0ef77c9f53a07258a3801.tar.bz2 rneovim-813476bf7291dfaf9fc0ef77c9f53a07258a3801.zip |
fix(exceptions): restore `did_throw` (#20000)
`!did_throw` doesn't exactly imply `!current_exception`, as `did_throw = false`
is sometimes used to defer exception handling for later (without forgetting the
exception). E.g: uncaught exception handling in `do_cmdline()` may be deferred
to a different call (e.g: when `try_level > 0`).
In #7881, `current_exception = NULL` in `do_cmdline()` is used as an analogue of
`did_throw = false`, but also causes the pending exception to be lost, which
also leaks as `discard_exception()` wasn't used.
It may be possible to fix this by saving/restoring `current_exception`, but
handling all of `did_throw`'s edge cases seems messier. Maybe not worth
diverging over.
This fix also uncovers a `man_spec.lua` bug on Windows: exceptions are thrown
due to Windows missing `man`, but they're lost; skip these tests if `man` isn't
executable.
Diffstat (limited to 'src/nvim/api/vimscript.c')
-rw-r--r-- | src/nvim/api/vimscript.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/nvim/api/vimscript.c b/src/nvim/api/vimscript.c index a28bfd2ab9..f6d0e39327 100644 --- a/src/nvim/api/vimscript.c +++ b/src/nvim/api/vimscript.c @@ -137,7 +137,7 @@ Object nvim_eval(String expr, Error *err) if (!recursive) { force_abort = false; suppress_errthrow = false; - current_exception = NULL; + did_throw = false; // `did_emsg` is set by emsg(), which cancels execution. did_emsg = false; } @@ -196,7 +196,7 @@ static Object _call_function(String fn, Array args, dict_T *self, Error *err) if (!recursive) { force_abort = false; suppress_errthrow = false; - current_exception = NULL; + did_throw = false; // `did_emsg` is set by emsg(), which cancels execution. did_emsg = false; } |