diff options
Diffstat (limited to 'py/persistentcode.c')
-rw-r--r-- | py/persistentcode.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/py/persistentcode.c b/py/persistentcode.c index de84c1735..67c8f327f 100644 --- a/py/persistentcode.c +++ b/py/persistentcode.c @@ -644,6 +644,9 @@ void mp_raw_code_save_file(mp_compiled_module_t *cm, const char *filename) { MP_THREAD_GIL_EXIT(); int fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC, 0644); MP_THREAD_GIL_ENTER(); + if (fd < 0) { + mp_raise_OSError_with_filename(errno, filename); + } mp_print_t fd_print = {(void *)(intptr_t)fd, fd_print_strn}; mp_raw_code_save(cm, &fd_print); MP_THREAD_GIL_EXIT(); |