neovim / pynvim

Python client and plugin host for Nvim
http://pynvim.readthedocs.io/en/latest/
Apache License 2.0
1.48k stars 118 forks source link

Reduce usage of deprecated imp module #455

Closed farisachugthai closed 3 years ago

farisachugthai commented 3 years ago

Replace imp.new_module with types.ModuleType which is available from py2.7 to 3+

justinmk commented 3 years ago

Thank you!

farisachugthai commented 3 years ago

Haha no problem! So I didn't get rid of every instance of imp because I'm not 100% sure how to replace the find_module and load_module calls.

2 of the classes with find/load_module calls are nested in a func themselves, so it'll probably be quite difficult to be sure that the API stays consistent before and after any changes.

Admittedly though, VimPathFinder has no __init__ and 2 staticmethods so it might not be very difficult to completely remove.

Since it's inside of the path hook func I can't imagine anyone externally relying on that portion of the API

justinmk commented 3 years ago

So I didn't get rid of every instance of imp because I'm not 100% sure how to replace the find_module and load_module calls.

yeah, I tried awhile ago and only got so far, so was happy that you made a bit more progress :) https://github.com/neovim/pynvim/pull/369