Use an appropriate `extract_traceback` limit
When looking for where this modules ``run/load`` ends and the user code begins we only need to search back at most three levels to find this information; so to avoid getting many more frames (especially when they won't be used) then we need to just apply a sensible limit on the levels we get. Change-Id: I9186e8844c92697b7e3f850328b6b39afba0150d
This commit is contained in:
committed by
Joshua Harlow
parent
cd664bdd3b
commit
50b866cceb
@@ -84,8 +84,9 @@ def _extract_engine(**kwargs):
|
||||
# Figure out where our code ends and the calling code begins (this is
|
||||
# needed since this code is called from two functions in this module,
|
||||
# which means the stack level will vary by one depending on that).
|
||||
finder = itertools.takewhile(lambda frame: frame[0] in _FILE_NAMES,
|
||||
reversed(traceback.extract_stack()))
|
||||
finder = itertools.takewhile(
|
||||
lambda frame: frame[0] in _FILE_NAMES,
|
||||
reversed(traceback.extract_stack(limit=3)))
|
||||
stacklevel = sum(1 for _frame in finder)
|
||||
decorator = deprecation.renamed_kwarg('engine_conf', 'engine',
|
||||
version="0.6",
|
||||
|
||||
Reference in New Issue
Block a user