Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 35.2k
gh-126835: Move constant tuple folding to CFG#130769
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
389f99fc1e4f237ffac414eae4233691e74ed312ad3e41b41f150c154331a0870c43884a44c02d0cd2a5e4d916475a2762f0429c8939fbee57e6f074ae59f8bffc456e8e70e0a7dbe98836c0ee72a3e65967a18e4b11cf8File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -554,7 +554,7 @@ def test_compile_async_generator(self): | ||
| self.assertEqual(type(glob['ticker']()), AsyncGeneratorType) | ||
| def test_compile_ast(self): | ||
| args = ("a*(1,2)", "f.py", "exec") | ||
| args = ("a*__debug__", "f.py", "exec") | ||
| raw = compile(*args, flags = ast.PyCF_ONLY_AST).body[0] | ||
| opt1 = compile(*args, flags = ast.PyCF_OPTIMIZED_AST).body[0] | ||
| opt2 = compile(ast.parse(args[0]), *args[1:], flags = ast.PyCF_OPTIMIZED_AST).body[0] | ||
| @@ -565,14 +565,14 @@ def test_compile_ast(self): | ||
| self.assertIsInstance(tree.value.left, ast.Name) | ||
| self.assertEqual(tree.value.left.id, 'a') | ||
| raw_right = raw.value.right # expect Tuple((1, 2)) | ||
| self.assertIsInstance(raw_right, ast.Tuple) | ||
| self.assertListEqual([elt.value for elt in raw_right.elts], [1, 2]) | ||
| raw_right = raw.value.right | ||
| self.assertIsInstance(raw_right, ast.Name) | ||
| self.assertEqual(raw_right.id, "__debug__") | ||
| for opt in [opt1, opt2]: | ||
| opt_right = opt.value.right # expect Constant((1,2)) | ||
| opt_right = opt.value.right | ||
| self.assertIsInstance(opt_right, ast.Constant) | ||
| self.assertEqual(opt_right.value, (1, 2)) | ||
| self.assertEqual(opt_right.value, True) | ||
iritkatriel marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| def test_delattr(self): | ||
| sys.spam = 1 | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1666,7 +1666,8 @@ def to_bool_str(): | ||
| def test_unpack_sequence(self): | ||
| def unpack_sequence_two_tuple(): | ||
| for _ in range(_testinternalcapi.SPECIALIZATION_THRESHOLD): | ||
| a, b = 1, 2 | ||
| t = 1, 2 | ||
| a, b = t | ||
iritkatriel marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| self.assertEqual(a, 1) | ||
| self.assertEqual(b, 2) | ||
| @@ -1677,8 +1678,11 @@ def unpack_sequence_two_tuple(): | ||
| def unpack_sequence_tuple(): | ||
| for _ in range(_testinternalcapi.SPECIALIZATION_THRESHOLD): | ||
| a, = 1, | ||
| a, b, c, d = 1, 2, 3, 4 | ||
| self.assertEqual(a, 1) | ||
| self.assertEqual(b, 2) | ||
| self.assertEqual(c, 3) | ||
| self.assertEqual(d, 4) | ||
| unpack_sequence_tuple() | ||
| self.assert_specialized(unpack_sequence_tuple, "UNPACK_SEQUENCE_TUPLE") | ||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.