Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 0 additions & 35 deletions test/dynamo/test_repros.py
Original file line number Diff line number Diff line change
Expand Up @@ -4075,41 +4075,6 @@ def forward(self, **inp):
res = torch.compile(mod, backend="eager", fullgraph=True)(**inputs)
self.assertEqual(ref, res)

def test_call_finally_python_3_8(self):
# Issue - https://github.com/pytorch/pytorch/issues/97811
def make_fn(g):
def fn():
while True:
try:
print(g)
break
except Exception as _:
break

return torch.compile(fn, backend="eager")

make_fn(None)()

def test_call_finally_python_3_8_2(self):
def f(x):
while x:
try:
pass
except Exception as _:
continue

torch.compile(f, backend="eager")(0)

def test_call_finally_opcode_python_3_8(self):
def fn():
try:
return torch.zeros(4)
finally:
return torch.ones(4) # noqa: SIM107, B012

result = torch.compile(fn, backend="aot_eager")()
self.assertEqual(result, torch.ones(4))

def test_string_format(self):
s = "temp{i}"

Expand Down
28 changes: 0 additions & 28 deletions torch/_dynamo/symbolic_convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -1709,34 +1709,6 @@ def WITH_CLEANUP_FINISH(self, inst):
self.popn(2)
self.push(None)

def CALL_FINALLY(self, inst):
"""
pushes the address of the next instruction onto the stack and increments
bytecode counter by delta
"""
# Python 3.8 only
addr = self.indexof[self.next_instruction]
self.push(ConstantVariable.create(addr))
self.jump(inst)

def END_FINALLY(self, inst):
# Python 3.8 only
# https://docs.python.org/3.8/library/dis.html#opcode-END_FINALLY
tos = self.pop()
if isinstance(tos, ConstantVariable):
self.instruction_pointer = tos.as_python_constant()
else:
pass

def POP_FINALLY(self, inst):
# Python 3.8 only
preserve_tos = inst.argval
if preserve_tos:
tos = self.pop()
_ = self.pop()
if preserve_tos:
self.push(tos) # type: ignore[possibly-undefined]

def FOR_ITER(self, inst):
it = self.pop().realize()
try:
Expand Down
Loading