diff options
author | zeertzjq <zeertzjq@outlook.com> | 2025-01-10 08:03:44 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-01-10 08:03:44 +0800 |
commit | 846a2019c0e3b3a91477c12ec2c4ac85861b4d67 (patch) | |
tree | 7fc086d63077a11ef87a18bea285482b5a7dc9e6 /test/functional/api/extmark_spec.lua | |
parent | 7c00e0efbb18e8627ac59eaadf564a9f1b2bafcd (diff) | |
download | rneovim-846a2019c0e3b3a91477c12ec2c4ac85861b4d67.tar.gz rneovim-846a2019c0e3b3a91477c12ec2c4ac85861b4d67.tar.bz2 rneovim-846a2019c0e3b3a91477c12ec2c4ac85861b4d67.zip |
vim-patch:9.1.0999: Vim9: leaking finished exception (#31939)
Problem: leaking finished exception
(after v9.1.0984)
Solution: use finish_exception to clean up caught exceptions
(Yee Cheng Chin)
In Vimscript, v:exception/throwpoint/stacktrace are supposed to reflect
the currently caught exception, and be popped after the exception is
finished (via endtry, finally, or a thrown exception inside catch).
Vim9script does not handle this properly, and leaks them instead. This
is clearly visible when launching GVim with menu enabled. A caught
exception inside the s:BMShow() in menu.vim would show up when querying
`v:stacktrace` even though the exception was already caught and handled.
To fix this, just use the same functionality as Vimscript by calling
`finish_exception` to properly restore the states. Note that this
assumes `current_exception` is always the same as `caught_stack` which
believe should be the case.
Added tests for this. Also fix up test_stacktrace to properly test the
stack restore behavior where we have nested exceptions in catch blocks
and to also test the vim9script functionality properly.
- Also, remove its dependency on explicitly checking a line number in
runtest.vim which is a very fragile way to write tests as any minor
change in runtest.vim (shared among all tests) would require changing
test_stacktrace.vim. We don't actually need such granularity in the
test.
closes: vim/vim#16413
https://github.com/vim/vim/commit/2051af1642843426714efc2572c3e270fe0948be
Co-authored-by: Yee Cheng Chin <ychin.git@gmail.com>
Diffstat (limited to 'test/functional/api/extmark_spec.lua')
0 files changed, 0 insertions, 0 deletions