Skip to content

Commit

Permalink
Fix: MP_QSTR_example changed to MP_QSTR_{mod.__name__}
Browse files Browse the repository at this point in the history
  • Loading branch information
IhorNehrutsa committed Sep 7, 2020
1 parent 1cb2de7 commit 294ee03
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/ustubby/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ def stub_module(mod):
# Set up the module properties
stub_ret.append("")
stub_ret.append(f"STATIC const mp_rom_map_elem_t {mod.__name__}_module_globals_table[] = {{")
stub_ret.append(f"\t{{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_example) }},")
stub_ret.append(f"\t{{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_{mod.__name__}) }},")
stub_ret.extend(
[f"\t{{ MP_ROM_QSTR(MP_QSTR_{f.__name__}), MP_ROM_PTR(&{mod.__name__}_{f.__name__}_obj) }}," for f in
functions])
Expand All @@ -335,7 +335,7 @@ def stub_module(mod):
# Register the module
stub_ret.append("")
stub_ret.append(
f"MP_REGISTER_MODULE(MP_QSTR_example, {mod.__name__}_user_cmodule, MODULE_{mod.__name__.upper()}_ENABLED);")
f"MP_REGISTER_MODULE(MP_QSTR_{mod.__name__}, {mod.__name__}_user_cmodule, MODULE_{mod.__name__.upper()}_ENABLED);")
return "\n".join(stub_ret)


Expand Down

1 comment on commit 294ee03

@IhorNehrutsa
Copy link
Contributor Author

Choose a reason for hiding this comment

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

MP_REGISTER_MODULE(MP_QSTR_example not acceptable.
Here two separate modules to test this fix.
uStubby_2_modules.zip

If we need several source code files in one module it will be a manual correction. In any case, it will be not an 'example' as a module name.
Thanks.

Please sign in to comment.