mirror of
https://github.com/python/cpython.git
synced 2025-07-24 11:44:31 +00:00
gh-119180: PEP 649 compiler changes (#119361)
This commit is contained in:
parent
02c1dfff07
commit
9b8611eeea
28 changed files with 610 additions and 329 deletions
|
@ -2,6 +2,7 @@
|
|||
|
||||
import dis
|
||||
import pickle
|
||||
import types
|
||||
import unittest
|
||||
|
||||
from test.support import check_syntax_error
|
||||
|
@ -440,7 +441,9 @@ class PositionalOnlyTestCase(unittest.TestCase):
|
|||
# without constant folding we end up with
|
||||
# COMPARE_OP(is), IS_OP (0)
|
||||
# with constant folding we should expect a IS_OP (1)
|
||||
codes = [(i.opname, i.argval) for i in dis.get_instructions(g)]
|
||||
code_obj = next(const for const in g.__code__.co_consts
|
||||
if isinstance(const, types.CodeType) and const.co_name == "__annotate__")
|
||||
codes = [(i.opname, i.argval) for i in dis.get_instructions(code_obj)]
|
||||
self.assertNotIn(('UNARY_NOT', None), codes)
|
||||
self.assertIn(('IS_OP', 1), codes)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue