Skip to content

Commit f4059dc

Browse files
committed
all: Use NULL instead of "" when calling mp_raise exception helpers.
This is the established way of doing it and reduces code size by a little bit.
1 parent cfff126 commit f4059dc

File tree

9 files changed

+10
-10
lines changed

9 files changed

+10
-10
lines changed

extmod/modlwip.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1032,7 +1032,7 @@ STATIC mp_obj_t lwip_socket_sendall(mp_obj_t self_in, mp_obj_t buf_in) {
10321032
break;
10331033
}
10341034
case MOD_NETWORK_SOCK_DGRAM:
1035-
mp_raise_NotImplementedError("");
1035+
mp_raise_NotImplementedError(NULL);
10361036
break;
10371037
}
10381038

extmod/modussl_axtls.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ STATIC mp_obj_t socket_setblocking(mp_obj_t self_in, mp_obj_t flag_in) {
152152
// Currently supports only blocking mode
153153
(void)self_in;
154154
if (!mp_obj_is_true(flag_in)) {
155-
mp_raise_NotImplementedError("");
155+
mp_raise_NotImplementedError(NULL);
156156
}
157157
return mp_const_none;
158158
}

extmod/modutimeq.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ STATIC mp_obj_t mod_utimeq_heappop(mp_obj_t heap_in, mp_obj_t list_ref) {
146146
}
147147
mp_obj_list_t *ret = MP_OBJ_TO_PTR(list_ref);
148148
if (!MP_OBJ_IS_TYPE(list_ref, &mp_type_list) || ret->len < 3) {
149-
mp_raise_TypeError("");
149+
mp_raise_TypeError(NULL);
150150
}
151151

152152
struct qentry *item = &heap->items[0];

extmod/modwebrepl.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ STATIC mp_obj_t webrepl_set_password(mp_obj_t passwd_in) {
308308
size_t len;
309309
const char *passwd = mp_obj_str_get_data(passwd_in, &len);
310310
if (len > sizeof(webrepl_passwd) - 1) {
311-
mp_raise_ValueError("");
311+
mp_raise_ValueError(NULL);
312312
}
313313
strcpy(webrepl_passwd, passwd);
314314
return mp_const_none;

ports/esp8266/machine_hspi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ mp_obj_t machine_hspi_make_new(const mp_obj_type_t *type, size_t n_args, size_t
149149
// args[0] holds the id of the peripheral
150150
if (args[0] != MP_OBJ_NEW_SMALL_INT(1)) {
151151
// FlashROM is on SPI0, so far we don't support its usage
152-
mp_raise_ValueError("");
152+
mp_raise_ValueError(NULL);
153153
}
154154

155155
machine_hspi_obj_t *self = m_new_obj(machine_hspi_obj_t);

ports/esp8266/machine_wdt.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ STATIC mp_obj_t machine_wdt_make_new(const mp_obj_type_t *type_in, size_t n_args
5151
case 0:
5252
return &wdt_default;
5353
default:
54-
mp_raise_ValueError("");
54+
mp_raise_ValueError(NULL);
5555
}
5656
}
5757

ports/unix/modjni.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ STATIC mp_obj_t jobject_subscr(mp_obj_t self_in, mp_obj_t index, mp_obj_t value)
266266
return mp_const_none;
267267
}
268268
}
269-
mp_raise_NotImplementedError("");
269+
mp_raise_NotImplementedError(NULL);
270270
}
271271

272272
if (!JJ(IsInstanceOf, self->obj, List_class)) {

py/objarray.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ STATIC mp_obj_t array_binary_op(mp_binary_op_t op, mp_obj_t lhs_in, mp_obj_t rhs
286286

287287
// Otherwise, can only look for a scalar numeric value in an array
288288
if (MP_OBJ_IS_INT(rhs_in) || mp_obj_is_float(rhs_in)) {
289-
mp_raise_NotImplementedError("");
289+
mp_raise_NotImplementedError(NULL);
290290
}
291291

292292
return mp_const_false;

py/objlist.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ STATIC mp_obj_t list_subscr(mp_obj_t self_in, mp_obj_t index, mp_obj_t value) {
158158
mp_obj_list_t *self = MP_OBJ_TO_PTR(self_in);
159159
mp_bound_slice_t slice;
160160
if (!mp_seq_get_fast_slice_indexes(self->len, index, &slice)) {
161-
mp_raise_NotImplementedError("");
161+
mp_raise_NotImplementedError(NULL);
162162
}
163163

164164
mp_int_t len_adj = slice.start - slice.stop;
@@ -198,7 +198,7 @@ STATIC mp_obj_t list_subscr(mp_obj_t self_in, mp_obj_t index, mp_obj_t value) {
198198
mp_obj_get_array(value, &value_len, &value_items);
199199
mp_bound_slice_t slice_out;
200200
if (!mp_seq_get_fast_slice_indexes(self->len, index, &slice_out)) {
201-
mp_raise_NotImplementedError("");
201+
mp_raise_NotImplementedError(NULL);
202202
}
203203
mp_int_t len_adj = value_len - (slice_out.stop - slice_out.start);
204204
//printf("Len adj: %d\n", len_adj);

0 commit comments

Comments
 (0)