Commit d6e962c4 authored by Gigg, Martyn Anthony's avatar Gigg, Martyn Anthony
Browse files

Trap all exceptions when generating code completions

If we cannot generate a valid completion list then we should
just stay silent and not show errors
parent b465e012
......@@ -54,6 +54,7 @@ General
- Fixed a bug where Workbench would hang on startup when running on Big Sur.
- Fixed a bug where TableWorkspace column names would not update correctly if the table was open.
- Fixed a bug applying constraints with the conjugate gradient minimizer.
- Fixed a bug where running a selection of a script could cause the error reporter to appear.
Interfaces
##########
......@@ -89,4 +90,4 @@ Plotting
- Fixed a bug where colorfill plots with a Log scale could not be saved during project save.
:ref:`Release 6.1.0 <v6.1.0>`
\ No newline at end of file
:ref:`Release 6.1.0 <v6.1.0>`
......@@ -91,18 +91,25 @@ def get_function_spec(func):
:returns: A string containing the function specification
"""
try:
argspec = getfullargspec(func)
except TypeError:
try:
args_obj = inspect.getargs(func.__code__)
argspec = ArgSpec(args_obj.args, args_obj.varargs, args_obj.varkw, defaults=None)
except (TypeError, AttributeError, ValueError):
if inspect.isbuiltin(func):
argspec = get_builtin_argspec(func)
if not argspec:
argspec = getfullargspec(func)
except TypeError:
try:
args_obj = inspect.getargs(func.__code__)
argspec = ArgSpec(args_obj.args, args_obj.varargs, args_obj.varkw, defaults=None)
except (TypeError, AttributeError, ValueError):
if inspect.isbuiltin(func):
argspec = get_builtin_argspec(func)
if not argspec:
return ''
else:
return ''
else:
return ''
except Exception:
# It's hard to determine all possible exception types that could happen
# above. We don't want errors if we can't generate completion so just
# bail out
return ''
# mantid algorithm functions have varargs set not args
args = argspec[0]
if args:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment