Skip to content

Commit 41b1df6

Browse files
committed
lib/memzip: Make lexer constructor raise exception when file not found.
1 parent 21420b1 commit 41b1df6

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/memzip/lexermemzip.c

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#include <stdlib.h>
22

33
#include "py/lexer.h"
4+
#include "py/runtime.h"
5+
#include "py/mperrno.h"
46
#include "memzip.h"
57

68
mp_lexer_t *mp_lexer_new_from_file(const char *filename)
@@ -9,7 +11,7 @@ mp_lexer_t *mp_lexer_new_from_file(const char *filename)
911
size_t len;
1012

1113
if (memzip_locate(filename, &data, &len) != MZ_OK) {
12-
return NULL;
14+
mp_raise_OSError(MP_ENOENT);
1315
}
1416

1517
return mp_lexer_new_from_str_len(qstr_from_str(filename), (const char *)data, (mp_uint_t)len, 0);

0 commit comments

Comments
 (0)