'-' in frozen module path not allowed

C programming, build, interpreter/VM.
Target audience: MicroPython Developers.
Post Reply
poesel
Posts: 18
Joined: Sun Oct 20, 2019 4:58 pm

'-' in frozen module path not allowed

Post by poesel » Mon Feb 24, 2020 4:05 pm

Hi,

I try to freeze some modules. Some of them live in /dist-packages. During the build I get a lot of error messages like:

build-GENERIC/frozen_content.c:5764:48: error: expected '=', ',', ';', 'asm' or '__attribute__' before '-' token
STATIC const mp_rom_obj_t const_table_data_dist-packages_shutil__lt_module_gt__rmtree[1] = {
^
The '^' is pointing at the '-'

If I rename the path to /distpackages it works. So the '-' is the source of the faults and that is intended to be like this?

Just asking for confirmation.

Thanks.

poesel
Posts: 18
Joined: Sun Oct 20, 2019 4:58 pm

Re: '-' in frozen module path not allowed

Post by poesel » Mon Feb 24, 2020 10:46 pm

Nevermind - my fault. Problem was that /dist-packages is not a module.

User avatar
jimmo
Posts: 1678
Joined: Tue Aug 08, 2017 1:57 am
Location: Sydney, Australia
Contact:

Re: '-' in frozen module path not allowed

Post by jimmo » Tue Feb 25, 2020 3:59 am

Yep. This could be handled better by the freezing process (it should escape special characters when generating the identifier names), but in this case pretty much anyhting that isn't valid as a C identifier (including "-") is also not valid in a module/package name in Python.

Post Reply