|
113 | 113 | VariableBase, |
114 | 114 | VariableFactory, |
115 | 115 | ) |
116 | | -from .virtual_frame import BlockStackItem |
117 | 116 |
|
118 | 117 | if TYPE_CHECKING: |
119 | 118 | from .function_graph import CompileGraphResult, FunctionGraph |
120 | 119 | from .variable_stack import VariableStack |
121 | 120 | from .virtual_frame import VirtualFrame |
122 | 121 |
|
123 | 122 | from .exception_stack import ExceptionStack |
| 123 | +from .virtual_frame import BlockStackItem |
124 | 124 |
|
125 | 125 | COMPARE_OP_NAME_TO_FN = { |
126 | 126 | ">": operator.gt, |
@@ -2189,45 +2189,6 @@ def RETURN_VALUE(self, instr: Instruction): |
2189 | 2189 | ret_val = self.stack.pop() |
2190 | 2190 | return self.compile_return(ret_val) |
2191 | 2191 |
|
2192 | | - @call_break_graph_decorator(push_n=2) |
2193 | | - @fallback_if_python_version_unsupported |
2194 | | - def SETUP_WITH(self, instr: Instruction): |
2195 | | - mgr = self.stack.pop() |
2196 | | - exit = BuiltinVariable( |
2197 | | - getattr, graph=self._graph, tracker=DanglingTracker() |
2198 | | - )(mgr, ConstantVariable.wrap_literal("__exit__", self._graph)) |
2199 | | - |
2200 | | - self.stack.push(exit) |
2201 | | - |
2202 | | - enter = BuiltinVariable( |
2203 | | - getattr, graph=self._graph, tracker=DanglingTracker() |
2204 | | - )(mgr, ConstantVariable.wrap_literal("__enter__", self._graph)) |
2205 | | - |
2206 | | - res = enter.call_function() |
2207 | | - self.vframe.block_stack.append( |
2208 | | - BlockStackItem( |
2209 | | - "SETUP_FINALLY", instr, instr.jump_to, len(self.stack) |
2210 | | - ) |
2211 | | - ) |
2212 | | - self.stack.push(res) |
2213 | | - |
2214 | | - @fallback_if_python_version_unsupported |
2215 | | - def WITH_EXCEPT_START(self, instr: Instruction): |
2216 | | - """ |
2217 | | - At the top of the stack are 7 values (top is last): |
2218 | | - [exit_func, previous_tb, previous_val, previous_exc, tb, val, exc] |
2219 | | - We call exit_func(exc, val, tb). |
2220 | | - Then push exc and the __exit__ return value. |
2221 | | - """ |
2222 | | - exc = self.stack.peek[1] |
2223 | | - val = self.stack.peek[2] |
2224 | | - tb = self.stack.peek[3] |
2225 | | - |
2226 | | - exit_func = self.stack.peek[7] |
2227 | | - res = exit_func.call_function(exc, val, tb) |
2228 | | - |
2229 | | - self.stack.push(res) |
2230 | | - |
2231 | 2192 | def RETURN_CONST(self, instr: Instruction): |
2232 | 2193 | ret_const = self.vframe.consts[instr.arg] |
2233 | 2194 | return self.compile_return(ret_const) |
|
0 commit comments