1
0
forked from VimPlug/jedi

Listeneres should be removed even in exception cases. Do a 'finally' cleanup.

This commit is contained in:
Dave Halter
2014-08-07 16:27:42 +02:00
parent 01bdd1e4fa
commit 483f5c14ee

View File

@@ -145,14 +145,15 @@ def search_params(evaluator, param):
listener = ParamListener()
func.listeners.add(listener)
result = []
# This is like backtracking: Get the first possible result.
for mod in imports.get_modules_containing_name([current_module], func_name):
result = get_params_for_module(mod)
if result:
break
# cleanup: remove the listener; important: should not stick.
func.listeners.remove(listener)
try:
result = []
# This is like backtracking: Get the first possible result.
for mod in imports.get_modules_containing_name([current_module], func_name):
result = get_params_for_module(mod)
if result:
break
finally:
# cleanup: remove the listener; important: should not stick.
func.listeners.remove(listener)
return result