kotlin-python icon indicating copy to clipboard operation
kotlin-python copied to clipboard

Adjust for no `__new__` method on MicroPython

Open krzema12 opened this issue 2 years ago • 1 comments

When trying to run e2e tests for MicroPython, the constructors test fails with:

  File "python/e2e-tests/out/python-consumer.py", line 6, in <module>
  File "/home/piotr/repos/priv/kotlin-python/python/e2e-tests/out/compiled.py", line 13692, in multi12
  File "/home/piotr/repos/priv/kotlin-python/python/e2e-tests/out/compiled.py", line 13670, in MultiConstructors1_init__Create_
AttributeError: type object 'MultiConstructors1' has no attribute '__new__'

Looks like __new__ is another magic method unavailable on MicroPython. We had to use + instead of __add__ already. Not sure if there's an equivalent here, but still it's a must to fix it given we want to support MP.

krzema12 avatar Nov 30 '21 12:11 krzema12

TODO: check why __new__ (magic method) was used, and if some non-magic method can be used instead.

krzema12 avatar Dec 01 '21 10:12 krzema12