Skip to content

py: Only load frozen modules when the filename has the prefix. - #235

Merged
dhalbert merged 2 commits into
adafruit:masterfrom
tannewt:fix_frozen_override
Sep 6, 2017
Merged

dhalbert merged 2 commits into
adafruit:masterfrom
tannewt:fix_frozen_override

Conversation

@tannewt

@tannewt tannewt commented Sep 5, 2017

Copy link
Copy Markdown
Member

This allows one to override a built-in module by loading a newer
version onto the file system.

This allows one to override a built-in module by loading a newer
version onto the file system.
@tannewt
tannewt requested a review from dhalbert September 6, 2017 01:35
@tannewt tannewt added this to the 2.0 milestone Sep 6, 2017
Comment thread py/builtinimport.c
// requested filename in the list of frozen module filenames.
#if MICROPY_MODULE_FROZEN
void *modref;
int frozen_type = mp_find_frozen_module(file_str + MP_FROZEN_FAKE_DIR_SLASH_LENGTH, file->len - MP_FROZEN_FAKE_DIR_SLASH_LENGTH, &modref);

@dhalbert dhalbert Sep 6, 2017 •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the checking for ".frozen/" here now means the checking for ".frozen/" in mp_find_frozen_module() is no longer needed. But we can just leave it in. Basically you hoisted that check up to where it was really needed.

This and pyexec_frozen_module() are the only calls to mp_find_frozen_module().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants