Skip to content

Commit 6b44f13

Browse files
committed
Fix python3.6 compatibility issue with dataclasses
1 parent 814ec68 commit 6b44f13

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
@@ -666,7 +666,8 @@ def _cls_for(cls, field: dataclasses.Field, index: int = 0) -> Type:
666666
"""Get the message class for a field from the type hints."""
667667
field_cls = cls._type_hint(field.name)
668668
if hasattr(field_cls, "__args__") and index >= 0:
669-
field_cls = field_cls.__args__[index]
669+
if field_cls.__args__ is not None:
670+
field_cls = field_cls.__args__[index]
670671
return field_cls
671672

672673
def _get_field_default(self, field_name):

0 commit comments

Comments
 (0)