def guard_invalid_slice(context, builder, typ, slicestruct): """ Guard against *slicestruct* having a zero step (and raise ValueError). """ if typ.has_step: cgutils.guard_null(context, builder, slicestruct.step, (ValueError, "slice step cannot be zero"))