#NEWLINE# def getComparisonExpressionBoolCode( comparator , left_name , right_name , needs_check , emit , context ) : #NEWLINE# #INDENT# if ( comparator in OperatorCodes . normal_comparison_codes ) : #NEWLINE# #INDENT# operator_res_name = context . allocateTempName ( ( 'cmp_' + comparator ) , 'int' ) #NEWLINE# emit ( ( '%s = PySequence_Contains( %s, %s );' % ( operator_res_name , right_name , left_name ) ) ) #NEWLINE# getErrorExitBoolCode ( condition = ( '%s == -1' % operator_res_name ) , emit = emit , needs_check = needs_check , context = context ) #NEWLINE# condition = ( '%s == %d' % ( operator_res_name , ( 1 if ( comparator == 'In' ) else 0 ) ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( comparator in OperatorCodes . rich_comparison_codes ) : #NEWLINE# #INDENT# operator_res_name = context . allocateTempName ( ( 'cmp_' + comparator ) , 'int' ) #NEWLINE# helper = OperatorCodes . rich_comparison_codes [ comparator ] #NEWLINE# if ( ( not context . mayRecurse ( ) ) and ( comparator == 'Eq' ) ) : #NEWLINE# #INDENT# helper += '_NORECURSE' #NEWLINE# #UNINDENT# emit ( ( '%s = RICH_COMPARE_BOOL_%s( %s, %s );' % ( operator_res_name , helper , left_name , right_name ) ) ) #NEWLINE# getErrorExitBoolCode ( condition = ( '%s == -1' % operator_res_name ) , needs_check = needs_check , emit = helper , context = context ) #NEWLINE# condition = ( '%s == 1' % ( operator_res_name , ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( comparator == 'Is' ) : #NEWLINE# #INDENT# operator_res_name = context . allocateTempName ( 'is' , 'bool' ) #NEWLINE# emit ( ( '%s = ( %s == %s );' % ( operator_res_name , left_name , right_name ) ) ) #NEWLINE# condition = operator_res_name #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( comparator == 'IsNot' ) : #NEWLINE# #INDENT# operator_res_name = context . allocateTempName ( 'isnot' , 'bool' ) #NEWLINE# emit ( ( '%s = ( %s != %s );' % ( operator_res_name , left_name , right_name ) ) ) #NEWLINE# condition = operator_res_name #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( comparator == 'exception_match' ) : #NEWLINE# #INDENT# operator_res_name = context . allocateTempName ( ( 'exc_match_' + comparator ) , 'int' ) #NEWLINE# emit ( ( '%s = EXCEPTION_MATCH_BOOL( %s, %s );' % ( operator_res_name , left_name , right_name ) ) ) #NEWLINE# getErrorExitBoolCode ( condition = ( '%s == -1' % operator_res_name ) , needs_check = needs_check , emit = emit , context = context ) #NEWLINE# condition = ( '%s == 1' % operator_res_name ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# assert False , comparator #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# getReleaseCode ( release_name = left_name , emit = emit , context = context ) #NEWLINE# getReleaseCode ( release_name = right_name , emit = emit , context = context ) #NEWLINE# getBranchingCode ( condition , emit , context )