You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by GitBox <gi...@apache.org> on 2022/05/18 00:32:05 UTC

[GitHub] [iceberg] kbendick commented on a diff in pull request #4797: Python - Fix tox errors for not calling super __init__ on a dataclass

kbendick commented on code in PR #4797:
URL: https://github.com/apache/iceberg/pull/4797#discussion_r875372781


##########
python/src/iceberg/types.py:
##########
@@ -208,6 +208,10 @@ def __init__(self, *fields: NestedField, **kwargs):
             fields = kwargs["fields"]
         object.__setattr__(self, "fields", fields)
 
+    # This __post_init__ call is needed as IcebergType is not a dataclass
+    def __post_init__(self):
+        super().__init__()

Review Comment:
   Yes, I believe that interferes with setting this to a frozen dataclass.
   
   See this SO (the answer at the bottom): https://stackoverflow.com/questions/66827839/super-classs-init-is-not-called-using-dataclass
   
   As well as this example: https://github.com/ericvsmith/dataclasses/issues/142



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org