Skip to content

Commit f36c764

Browse files
[dynamo][ez] Initialize tracer_output to None by default. (pytorch#167366)
[dynamo][ez] Initialize tracer_output to None by default. (pytorch#163169) Summary: In edge cases, tracer_output can be left unset if there's double exception raised which causes the following issue: ``` UnboundLocalError: local variable 'tracer_output' referenced before assignment ``` Default initialize this variable so that it's always present. Test Plan: CI Rollback Plan: Differential Revision: D82652815 Pull Request resolved: pytorch#163169 Approved by: https://github.com/tugsbayasgalan (cherry picked from commit 6189a5f) Co-authored-by: Zhengxu Chen <[email protected]>
1 parent 6877288 commit f36c764

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

torch/_dynamo/convert_frame.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1429,6 +1429,7 @@ def format_func_info(code: CodeType) -> str:
14291429
fail_user_frame_lineno: Optional[int] = None
14301430
torch._dynamo.utils.ReinplaceCounters.clear()
14311431
guarded_code = None
1432+
tracer_output = None
14321433
try:
14331434
guarded_code, tracer_output = compile_inner(code, one_graph, hooks)
14341435

0 commit comments

Comments
 (0)