diff --git a/executing/executing.py b/executing/executing.py index 7727c42..5cf117e 100644 --- a/executing/executing.py +++ b/executing/executing.py @@ -273,16 +273,15 @@ def executing(cls, frame_or_tb): node_finder = NodeFinder(frame, stmts, tree, lasti, source) node = node_finder.result decorator = node_finder.decorator + + if node: + new_stmts = {statement_containing_node(node)} + assert_(new_stmts <= stmts) + stmts = new_stmts except Exception: if TESTING: raise - assert stmts is not None - if node: - new_stmts = {statement_containing_node(node)} - assert_(new_stmts <= stmts) - stmts = new_stmts - executing_cache[key] = args = source, node, stmts, decorator return Executing(frame, *args)