2828 RType ,
2929 RUnion ,
3030 int_rprimitive ,
31- is_bit_rprimitive ,
32- is_bool_rprimitive ,
31+ is_bool_or_bit_rprimitive ,
3332 is_bytes_rprimitive ,
3433 is_dict_rprimitive ,
3534 is_fixed_width_rtype ,
@@ -615,8 +614,7 @@ def emit_cast(
615614 or is_range_rprimitive (typ )
616615 or is_float_rprimitive (typ )
617616 or is_int_rprimitive (typ )
618- or is_bool_rprimitive (typ )
619- or is_bit_rprimitive (typ )
617+ or is_bool_or_bit_rprimitive (typ )
620618 or is_fixed_width_rtype (typ )
621619 ):
622620 if declare_dest :
@@ -638,7 +636,7 @@ def emit_cast(
638636 elif is_int_rprimitive (typ ) or is_fixed_width_rtype (typ ):
639637 # TODO: Range check for fixed-width types?
640638 prefix = "PyLong"
641- elif is_bool_rprimitive ( typ ) or is_bit_rprimitive (typ ):
639+ elif is_bool_or_bit_rprimitive (typ ):
642640 prefix = "PyBool"
643641 else :
644642 assert False , f"unexpected primitive type: { typ } "
@@ -744,7 +742,7 @@ def emit_cast_error_handler(
744742 self .emit_traceback (error .source_path , error .module_name , error .traceback_entry )
745743 self .emit_line ("goto %s;" % error .label )
746744 else :
747- assert isinstance (error , ReturnHandler )
745+ assert isinstance (error , ReturnHandler ), error
748746 self .emit_line ("return %s;" % error .value )
749747
750748 def emit_union_cast (
@@ -873,7 +871,7 @@ def emit_unbox(
873871 elif isinstance (error , GotoHandler ):
874872 failure = "goto %s;" % error .label
875873 else :
876- assert isinstance (error , ReturnHandler )
874+ assert isinstance (error , ReturnHandler ), error
877875 failure = "return %s;" % error .value
878876 if raise_exception :
879877 raise_exc = f'CPy_TypeError("{ self .pretty_name (typ )} ", { src } ); '
@@ -889,7 +887,7 @@ def emit_unbox(
889887 self .emit_line ("else {" )
890888 self .emit_line (failure )
891889 self .emit_line ("}" )
892- elif is_bool_rprimitive ( typ ) or is_bit_rprimitive (typ ):
890+ elif is_bool_or_bit_rprimitive (typ ):
893891 # Whether we are borrowing or not makes no difference.
894892 if declare_dest :
895893 self .emit_line (f"char { dest } ;" )
@@ -1015,7 +1013,7 @@ def emit_box(
10151013 if is_int_rprimitive (typ ) or is_short_int_rprimitive (typ ):
10161014 # Steal the existing reference if it exists.
10171015 self .emit_line (f"{ declaration } { dest } = CPyTagged_StealAsObject({ src } );" )
1018- elif is_bool_rprimitive ( typ ) or is_bit_rprimitive (typ ):
1016+ elif is_bool_or_bit_rprimitive (typ ):
10191017 # N.B: bool is special cased to produce a borrowed value
10201018 # after boxing, so we don't need to increment the refcount
10211019 # when this comes directly from a Box op.
0 commit comments