@@ -341,6 +341,10 @@ def test_lambda_doc(self):
341341l = lambda :"foo"
342342self .assertIsNone (l .__doc__ )
343343
344+ def test_lambda_consts (self ):
345+ l = lambda :"this is the only const"
346+ self .assertEqual (len (l .__code__ .co_consts ),1 )
347+
344348def test_encoding (self ):
345349code = b'# -*- coding: badencoding -*-\n pass\n '
346350self .assertRaises (SyntaxError ,compile ,code ,'tmp' ,'exec' )
@@ -789,10 +793,10 @@ def check_same_constant(const):
789793# Merge constants in tuple or frozenset
790794f1 ,f2 = lambda :"not a name" ,lambda : ("not a name" ,)
791795f3 = lambda x :x in {("not a name" ,)}
792- self .assertIs (f1 .__code__ .co_consts [1 ],
793- f2 .__code__ .co_consts [1 ][0 ])
794- self .assertIs (next (iter (f3 .__code__ .co_consts [1 ])),
795- f2 .__code__ .co_consts [1 ])
796+ self .assertIs (f1 .__code__ .co_consts [0 ],
797+ f2 .__code__ .co_consts [0 ][0 ])
798+ self .assertIs (next (iter (f3 .__code__ .co_consts [0 ])),
799+ f2 .__code__ .co_consts [0 ])
796800
797801# {0} is converted to a constant frozenset({0}) by the peephole
798802# optimizer