py/emitglue: Use more compact mp_raise_ValueError function.
This commit is contained in:
parent
fe3cc5bb53
commit
26295e04ff
@ -348,12 +348,10 @@ mp_raw_code_t *mp_raw_code_load(mp_reader_t *reader) {
|
|||||||
byte header[4];
|
byte header[4];
|
||||||
read_bytes(reader, header, sizeof(header));
|
read_bytes(reader, header, sizeof(header));
|
||||||
if (strncmp((char*)header, "M\x00", 2) != 0) {
|
if (strncmp((char*)header, "M\x00", 2) != 0) {
|
||||||
nlr_raise(mp_obj_new_exception_msg(&mp_type_ValueError,
|
mp_raise_ValueError("invalid .mpy file");
|
||||||
"invalid .mpy file"));
|
|
||||||
}
|
}
|
||||||
if (header[2] != MPY_FEATURE_FLAGS || header[3] > mp_small_int_bits()) {
|
if (header[2] != MPY_FEATURE_FLAGS || header[3] > mp_small_int_bits()) {
|
||||||
nlr_raise(mp_obj_new_exception_msg(&mp_type_ValueError,
|
mp_raise_ValueError("incompatible .mpy file");
|
||||||
"incompatible .mpy file"));
|
|
||||||
}
|
}
|
||||||
return load_raw_code(reader);
|
return load_raw_code(reader);
|
||||||
}
|
}
|
||||||
@ -559,8 +557,7 @@ STATIC void save_bytecode_qstrs(mp_print_t *print, const byte *ip, const byte *i
|
|||||||
|
|
||||||
STATIC void save_raw_code(mp_print_t *print, mp_raw_code_t *rc) {
|
STATIC void save_raw_code(mp_print_t *print, mp_raw_code_t *rc) {
|
||||||
if (rc->kind != MP_CODE_BYTECODE) {
|
if (rc->kind != MP_CODE_BYTECODE) {
|
||||||
nlr_raise(mp_obj_new_exception_msg(&mp_type_ValueError,
|
mp_raise_ValueError("can only save bytecode");
|
||||||
"can only save bytecode"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// save bytecode
|
// save bytecode
|
||||||
|
Loading…
Reference in New Issue
Block a user