mirror of
https://github.com/davidhalter/jedi.git
synced 2026-05-18 06:19:39 +08:00
Listeneres should be removed even in exception cases. Do a 'finally' cleanup.
This commit is contained in:
@@ -145,14 +145,15 @@ def search_params(evaluator, param):
|
|||||||
listener = ParamListener()
|
listener = ParamListener()
|
||||||
func.listeners.add(listener)
|
func.listeners.add(listener)
|
||||||
|
|
||||||
result = []
|
try:
|
||||||
# This is like backtracking: Get the first possible result.
|
result = []
|
||||||
for mod in imports.get_modules_containing_name([current_module], func_name):
|
# This is like backtracking: Get the first possible result.
|
||||||
result = get_params_for_module(mod)
|
for mod in imports.get_modules_containing_name([current_module], func_name):
|
||||||
if result:
|
result = get_params_for_module(mod)
|
||||||
break
|
if result:
|
||||||
|
break
|
||||||
# cleanup: remove the listener; important: should not stick.
|
finally:
|
||||||
func.listeners.remove(listener)
|
# cleanup: remove the listener; important: should not stick.
|
||||||
|
func.listeners.remove(listener)
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|||||||
Reference in New Issue
Block a user