Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -1075,7 +1075,7 @@ def KW_NAMES(self, instr: Instruction):
assert isinstance(instr.arg, int)
self._call_shape = self._co_consts[instr.arg].get_py_value()

def CALL(self, instr: Instruction):
def call(self, instr: Instruction):
assert isinstance(instr.arg, int)
assert instr.arg + 2 <= len(self.stack)
is_method = not isinstance(self.stack.peek[instr.arg + 2], NullVariable)
Expand All @@ -1093,6 +1093,12 @@ def CALL(self, instr: Instruction):
self.stack.push(fn(*args, **kwargs))
self._call_shape = None

CALL = (
call_break_graph_decorator(push_n=1)(call)
if sys.version_info >= (3, 12)
else call
)

@call_break_graph_decorator(push_n=1)
def CALL_FUNCTION(self, instr: Instruction):
assert isinstance(instr.arg, int)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -797,6 +797,8 @@ def gen_load_attr(self, name: str):
if name not in self._code_options["co_names"]:
self._code_options["co_names"].append(name)
idx = self._code_options["co_names"].index(name)
if sys.version_info >= (3, 12):
idx <<= 1
self._add_instr("LOAD_ATTR", arg=idx, argval=name)

def gen_store_attr(self, name: str):
Expand Down Expand Up @@ -878,7 +880,7 @@ def gen_unpack_sequence(self, count):

def gen_call_function(self, argc=0):
if sys.version_info >= (3, 11):
if sys.version_info >= (3, 11) and sys.version_info < (3, 12):
if sys.version_info < (3, 12):
self._add_instr("PRECALL", arg=argc, argval=argc)
self._add_instr("CALL", arg=argc, argval=argc)
else:
Expand All @@ -892,7 +894,7 @@ def gen_call_function_ex(self, has_kwargs):

def gen_call_method(self, argc=0):
if sys.version_info >= (3, 11):
if sys.version_info >= (3, 11) and sys.version_info < (3, 12):
if sys.version_info < (3, 12):
self._add_instr("PRECALL", arg=argc, argval=argc)
self._add_instr("CALL", arg=argc, argval=argc)
else:
Expand Down
10 changes: 0 additions & 10 deletions test/sot/skip_files_py312
Original file line number Diff line number Diff line change
@@ -1,27 +1,18 @@
./test_01_basic.py
./test_03_tuple.py
./test_04_list.py
./test_05_dict.py
./test_07_unpack.py
./test_09_f_string.py
./test_10_build_unpack.py
./test_11_jumps.py
./test_12_for_loop.py
./test_14_operators.py
./test_15_slice.py
./test_17_paddle_layer.py
./test_18_tensor_method.py
./test_19_closure.py
./test_20_string.py
./test_21_global.py
./test_analysis_inputs.py
./test_binary_operator_tracker.py
./test_break_graph.py
./test_builtin_dispatch.py
./test_builtin_map.py
./test_builtin_range.py
./test_builtin_zip.py
./test_constant_graph.py
./test_dup_top.py
./test_enumerate.py
./test_guard_user_defined_fn.py
Expand All @@ -33,7 +24,6 @@
./test_simulate_initialize.py
./test_sir_rollback.py
./test_sot_cost_model.py
./test_sot_exception.py
./test_sot_export.py
./test_sot_resnet.py
./test_sot_resnet50_backward.py
Expand Down