Open
Description
The following 'test.py' produces a crash with the unix port. In this example, we clear the dic when defining the dic, then micropython crashes.
test.py
class S(str):
def __eq__(self, other):
d.clear()
def __hash__(self):
return hash('test')
d = {S(): 'value'}
'test' in d
Error message:
Floating point exception (core dumped)
The expected output: work well (behavior on CPython 3.10.8)
how to replicate it:
- install micropython (unix port)
- run it with unix port
-
->> 'micropython/ports/unix/build-standard/micropython' test.py
Environment
compiler versions: MicroPython v1.19.1-724-gfb7d21153 on 2023-03-07; linux [GCC 7.5.0] version
operating system: Ubuntu 18.04.6 LTS