diff options
author | Irit Katriel <1055913+iritkatriel@users.noreply.github.com> | 2024-04-17 15:42:04 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-17 15:42:04 (GMT) |
commit | c179c0e6cbb4d1e981fffd43f207f5b1aa5388e5 (patch) | |
tree | 4600115b3e61e7404b550d81a23a235d31c183fb /Lib/test/test_compiler_assemble.py | |
parent | ae8dfd2761e4a45afe0adada0f91f371dd121bb8 (diff) | |
download | cpython-c179c0e6cbb4d1e981fffd43f207f5b1aa5388e5.zip cpython-c179c0e6cbb4d1e981fffd43f207f5b1aa5388e5.tar.gz cpython-c179c0e6cbb4d1e981fffd43f207f5b1aa5388e5.tar.bz2 |
gh-117680: make _PyInstructionSequence a PyObject and use it in tests (#117629)
Diffstat (limited to 'Lib/test/test_compiler_assemble.py')
-rw-r--r-- | Lib/test/test_compiler_assemble.py | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/Lib/test/test_compiler_assemble.py b/Lib/test/test_compiler_assemble.py index ab9f04d..1b98b0d 100644 --- a/Lib/test/test_compiler_assemble.py +++ b/Lib/test/test_compiler_assemble.py @@ -27,8 +27,8 @@ class IsolatedAssembleTests(AssemblerTestCase): def insts_to_code_object(self, insts, metadata): metadata = self.complete_metadata(metadata) - insts = self.complete_insts_info(insts) - return self.get_code_object(metadata['filename'], insts, metadata) + seq = self.seq_from_insts(insts) + return self.get_code_object(metadata['filename'], seq, metadata) def assemble_test(self, insts, metadata, expected): co = self.insts_to_code_object(insts, metadata) @@ -71,7 +71,7 @@ class IsolatedAssembleTests(AssemblerTestCase): ('BINARY_OP', 0, 1), # '+' ('LOAD_CONST', 0, 1), # 2 ('BINARY_OP', 11, 1), # '/' - ('RETURN_VALUE', 1), + ('RETURN_VALUE', None, 1), ] expected = {(3, 4) : 3.5, (-100, 200) : 50, (10, 18) : 14} self.assemble_test(insts, metadata, expected) @@ -102,13 +102,13 @@ class IsolatedAssembleTests(AssemblerTestCase): ('LOAD_CLOSURE', 0, 1), ('BUILD_TUPLE', 1, 1), ('LOAD_CONST', 1, 1), - ('MAKE_FUNCTION', 0, 2), + ('MAKE_FUNCTION', None, 2), ('SET_FUNCTION_ATTRIBUTE', 8, 2), - ('PUSH_NULL', 0, 1), + ('PUSH_NULL', None, 1), ('CALL', 0, 2), # (lambda: x)() ('LOAD_CONST', 2, 2), # 2 ('BINARY_OP', 6, 2), # % - ('RETURN_VALUE', 0, 2) + ('RETURN_VALUE', None, 2) ] expected = {(0,): 0, (1,): 1, (2,): 0, (120,): 0, (121,): 1} @@ -128,12 +128,12 @@ class IsolatedAssembleTests(AssemblerTestCase): ('SETUP_FINALLY', 3), ('RETURN_CONST', 0), ('SETUP_CLEANUP', 8), - ('PUSH_EXC_INFO', 0), - ('POP_TOP', 0), - ('POP_EXCEPT', 0), + ('PUSH_EXC_INFO', None), + ('POP_TOP', None), + ('POP_EXCEPT', None), ('RETURN_CONST', 0), ('COPY', 3), - ('POP_EXCEPT', 0), + ('POP_EXCEPT', None), ('RERAISE', 1), ] co = self.insts_to_code_object(insts, metadata) |