mirror of
https://github.com/zebrajr/pytorch.git
synced 2025-12-06 12:20:52 +01:00
[export] Allow user frame to be None when symbolic shape tries to get stacktrace. (#155744)
Summary: Fixing https://github.com/pytorch/pytorch/issues/155605 Test Plan: CI Rollback Plan: Differential Revision: D76463358 Pull Request resolved: https://github.com/pytorch/pytorch/pull/155744 Approved by: https://github.com/angelayi
This commit is contained in:
parent
dd1b6621bc
commit
0fd711df19
|
|
@ -7003,13 +7003,12 @@ class ShapeEnv:
|
|||
stack_info=True if log.getEffectiveLevel() < logging.WARNING else False,
|
||||
)
|
||||
|
||||
def _get_user_frame(self) -> types.FrameType:
|
||||
def _get_user_frame(self) -> Optional[types.FrameType]:
|
||||
frame = inspect.currentframe()
|
||||
while frame is not None:
|
||||
if frame.f_code.co_filename not in uninteresting_files():
|
||||
return frame
|
||||
frame = frame.f_back
|
||||
assert frame is not None
|
||||
return frame
|
||||
|
||||
def _get_stack_summary(
|
||||
|
|
@ -7019,6 +7018,7 @@ class ShapeEnv:
|
|||
if floc is None:
|
||||
frame = self._get_user_frame()
|
||||
try:
|
||||
if frame is not None:
|
||||
floc = traceback.FrameSummary(
|
||||
frame.f_code.co_filename,
|
||||
frame.f_lineno,
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user