brentyi / tyro

CLI interfaces & config objects, from types

Home Page:https://brentyi.github.io/tyro

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

unbound method type.mro() needs an argument

grauvictor opened this issue · comments

I get the following error:

File "/home/victor/venv-python3.9-llm-explo/lib/python3.9/site-packages/tyro/_docstrings.py", line 121, in get_class_tokenization_with_field
    classes_to_search = cls.mro()
TypeError: unbound method type.mro() needs an argument

Du to the following line:

classes_to_search = cls.mro()

Called on the following type:
<class 'pydantic.v1.main.ModelMetaclass'>

Suggestion:
Replace

classes_to_search = cls.mro()

by:
classes_to_search = cls.__mro__

Hi, thanks for filing this issue and the fix suggestion!

Are you able to share a runnable example for reproducing the error? The fix seems reasonable, but I'm not fully following the root cause of the problem (particularly in what situation the cls value gets set to a metaclass) and it'd be nice to include this case in the unit tests.