8b2115ec26
It turns out that vim.eval() will attempt to do Unicode conversion and can fail when raw bytes are present in the unnamed register. To avoid this problem, let's not carry the value across the bridge, and instead store the cached value in Vim directly. This successfully sidesteps the issue entirely, and provides the correct save and restore behavior. This also adds a test case for the issue. Since expansion can finish (despite the errors), the test has to capture the error messages and examine them for a failure.