Skip to content

mpy-cross compiles bad code #17255

Closed
Closed
@Tangerino

Description

@Tangerino

Port, board and/or hardware

ESP32

MicroPython version

MicroPython v1.23.0-preview.332.g49ce7a607.dirty on 2024-04-22; mpy-cross emitting mpy v6.3

Reproduction

This code

from typing import List

my_list: List = []

print(mylist)

Fails to run, as expected

>>> import typing
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: no module named 'typing'
>>> import typing_test
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "typing_test.py", line 1, in <module>
ImportError: no module named 'typing'

But can be compiled as in:

Image

Expected behaviour

Expected compilation error since the module does not exists

Observed behaviour

I expected an output error since the module typing does not exists and I discovered this only in runtime

Additional Information

No, I've provided everything above.

Code of Conduct

Yes, I agree

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions