roxma / vim-hug-neovim-rpc

EXPERIMENTAL
MIT License
218 stars 28 forks source link

ignore function name error when passing function to client #45

Closed roxma closed 5 years ago

roxma commented 5 years ago

https://github.com/roxma/nvim-yarp/issues/18#issuecomment-442735631

@ichizok Please test this pr

ichizok commented 5 years ago

I think .encode() is not need. When trying to access .name, PyUnicode_Decode() is called in if_python3 and if it succeeds we can actually access .name, or if fails we catch UnicodeDecodeError (thrown from if_python3). Therefore if we can access .name then .encode() will succeed.

roxma commented 5 years ago

It's not needed for python3. But python2 needs this to raise an exception.

ichizok commented 5 years ago

Python2 does not raise an error since .name is str type; treated as simply byte sequence.

roxma commented 5 years ago

Python2 does not raise an error since .name is str type; treated as simply byte sequence.

Yeah. This plugin running as a server, and it allows to use python2. Howver, if the invalid utf8 byte sequence is sent to python3 client, a wired exception would be raised on the client side.

rubdos commented 5 years ago

I indeed have this issue in deoplete in vim8. Cfr. my misplaced bug report at https://github.com/neovim/pynvim/issues/371, I believe your pull relieves this issue.