fix: nicer error message on bench execute
This commit is contained in:
parent
0c6fffa348
commit
6a95540bf5
1 changed files with 4 additions and 2 deletions
|
|
@ -280,10 +280,12 @@ def execute(context, method, args=None, kwargs=None, profile=False):
|
|||
ret = frappe.get_attr(method)(*args, **kwargs)
|
||||
except Exception:
|
||||
# eval is safe here because input is from console
|
||||
ret = eval(method, globals(), locals()) # nosemgrep
|
||||
code = compile(method, "<bench execute>", "eval")
|
||||
ret = eval(code, globals(), locals()) # nosemgrep
|
||||
if callable(ret):
|
||||
suffix = "(*args, **kwargs)"
|
||||
ret = eval(method + suffix, globals(), locals()) # nosemgrep
|
||||
code = compile(method + suffix, "<bench execute>", "eval")
|
||||
ret = eval(code, globals(), locals()) # nosemgrep
|
||||
|
||||
if profile:
|
||||
import pstats
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue