8000 utils/pyexec: Allow pyexec_file_if_exists to run frozen files if they… · micropython/micropython@94acf41 · GitHub
[go: up one dir, main page]

Skip to content

Commit 94acf41

Browse files
committed
utils/pyexec: Allow pyexec_file_if_exists to run frozen files if they exist.
1 parent f7dbe82 commit 94acf41

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

lib/utils/pyexec.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -542,8 +542,12 @@ int pyexec_file(const char *filename) {
542542
}
543543

544544
int pyexec_file_if_exists(const char *filename) {
545-
mp_import_stat_t stat = mp_import_stat(filename);
546-
if (stat != MP_IMPORT_STAT_FILE) {
545+
#if MICROPY_MODULE_FROZEN
546+
if (mp_frozen_stat(filename) == MP_IMPORT_STAT_FILE) {
547+
return pyexec_frozen_module(filename);
548+
}
549+
#endif
550+
if (mp_import_stat(filename) != MP_IMPORT_STAT_FILE) {
547551
return 1; // success (no file is the same as an empty file executing without fail)
548552
}
549553
return pyexec_file(filename);

0 commit comments

Comments
 (0)
0