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

Refactor: Remove usage of imp #461

Closed farisachugthai closed 12 months ago

farisachugthai commented 3 years ago

Since there are no reasonable alternatives to imp in python2.7, I figured it'd be the easiest to try importing python3 modules and if that fails, fall back to the previous method. However this will remove that annoying DeprecationWarning for everyone using python3.

bfredl commented 3 years ago

don't be too afraid to break 2.7 if there is clear benefit. pynvim 0.5 can be py3.5+ only if we want to.

farisachugthai commented 3 years ago

Hahaha thanks for the tip! I wanted this refactored to a separate function so that if the decision to go pure py3 gets made we have the weird py2 / py3 thing contained to 1 function and can simply remove the except ImportError: import imp malarky

Shougo commented 3 years ago

I think it fixes my issue. https://github.com/neovim/pynvim/issues/478

The PR is completed?

Shougo commented 3 years ago

I think compat.py and scripts_host.py needs to be changed.

Shougo commented 3 years ago

I have imported your commit in https://github.com/neovim/pynvim/pull/486.