aboutsummaryrefslogtreecommitdiff
path: root/runtime/autoload/provider
diff options
context:
space:
mode:
authorsupermomonga <hi@supermomonga.com>2019-10-28 06:27:22 +0900
committerJustin M. Keyes <justinkz@gmail.com>2019-10-27 14:27:22 -0700
commit31536ae003c0bd0ee311fc97b26ded0db8b3fa34 (patch)
treeb8382a43ff635f54ba2863842270ea687b4940d4 /runtime/autoload/provider
parente085cacba4e98e476da157616591c24d97b402c7 (diff)
downloadrneovim-31536ae003c0bd0ee311fc97b26ded0db8b3fa34.tar.gz
rneovim-31536ae003c0bd0ee311fc97b26ded0db8b3fa34.tar.bz2
rneovim-31536ae003c0bd0ee311fc97b26ded0db8b3fa34.zip
provider/pythonx: don't assume CWD (empty string) is in path #11304
sys.path.remove("") raises ValueError if the item is missing. https://docs.python.org/3/library/functions.html#filter: > filter(function, iterable) is equivalent to the generator expression (item > for item in iterable if function(item)) fixes #11293
Diffstat (limited to 'runtime/autoload/provider')
-rw-r--r--runtime/autoload/provider/pythonx.vim5
1 files changed, 3 insertions, 2 deletions
diff --git a/runtime/autoload/provider/pythonx.vim b/runtime/autoload/provider/pythonx.vim
index 6ce7165467..aec18c0508 100644
--- a/runtime/autoload/provider/pythonx.vim
+++ b/runtime/autoload/provider/pythonx.vim
@@ -10,7 +10,8 @@ function! provider#pythonx#Require(host) abort
" Python host arguments
let prog = (ver == '2' ? provider#python#Prog() : provider#python3#Prog())
- let args = [prog, '-c', 'import sys; sys.path.remove(""); import neovim; neovim.start_host()']
+ let args = [prog, '-c', 'import sys; sys.path = list(filter(lambda x: x != "", sys.path)); import neovim; neovim.start_host()']
+
" Collect registered Python plugins into args
let python_plugins = remote#host#PluginsForHost(a:host.name)
@@ -66,7 +67,7 @@ endfunction
function! s:import_module(prog, module) abort
let prog_version = system([a:prog, '-c' , printf(
\ 'import sys; ' .
- \ 'sys.path.remove(""); ' .
+ \ 'sys.path = list(filter(lambda x: x != "", sys.path)); ' .
\ 'sys.stdout.write(str(sys.version_info[0]) + "." + str(sys.version_info[1])); ' .
\ 'import pkgutil; ' .
\ 'exit(2*int(pkgutil.get_loader("%s") is None))',