google / grumpy

Grumpy is a Python to Go source code transcompiler and runtime.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

TypeError: class must have base classes

m4ns0ur opened this issue · comments

any transcompiled simple (empty) python class, raising same error:

TypeError: class must have base classes

to reproduce the issue, create a python file with below code, then transcompile, and run:

class c:
    pass

it is happening because of a sanity check here, anyway it needs more investigation to see why base class is empty there.

@trotterdylan any comment on this?

Classes without a list of bases are old style classes, and Grumpy doesn't current support them. I've debated whether to bother supporting old style classes since Python 3 gets rid of them.

Unfortunately there are subtle behavioral differences between new and old style classes so we can't just pretend to support them by replacing the empty list of bases with (object).

For modules that use old style classes, I've just been modifying the code to add the object base class and hoping that they continue to work correctly.

@trotterdylan thanks! I'll try to do same for the modules.