liferoad commented on code in PR #33157:
URL: https://github.com/apache/beam/pull/33157#discussion_r1847246821


##########
sdks/python/apache_beam/coders/coder_impl.py:
##########
@@ -500,7 +500,9 @@ def encode_special_deterministic(self, value, stream):
         self.encode_to_stream(value.value, stream, True)
       except Exception as e:
         raise TypeError(self._deterministic_encoding_error_msg(value)) from e
-    elif hasattr(value, "__getstate__"):
+    elif (hasattr(value, "__getstate__") and
+          # https://github.com/apache/beam/issues/33020
+          type(value).__reduce__ == object.__reduce):
       if not hasattr(value, "__setstate__"):

Review Comment:
   are we sure this works?
   ```
   class MyClass:
       def __init__(self, value):
           self.value = value
   
       def __reduce__(self):
           return (self.__class__, (self.value,))
   
   tt = MyClass(1)
   print(object.__reduce__ == type(tt).__reduce__)
   ```
   This also returns False. I might misunderstand how this works.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to