Skip to content

Commit ce2bea2

Browse files
committed
Fix python3.6 compatibility issue with dataclasses
1 parent 7c556b3 commit ce2bea2

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/betterproto/__init__.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -664,7 +664,8 @@ def _cls_for(cls, field: dataclasses.Field, index: int = 0) -> Type:
664664
"""Get the message class for a field from the type hints."""
665665
field_cls = cls._type_hint(field.name)
666666
if hasattr(field_cls, "__args__") and index >= 0:
667-
field_cls = field_cls.__args__[index]
667+
if field_cls.__args__ is not None:
668+
field_cls = field_cls.__args__[index]
668669
return field_cls
669670

670671
def _get_field_default(self, field_name):

0 commit comments

Comments
 (0)