KevinGG commented on code in PR #17531:
URL: https://github.com/apache/beam/pull/17531#discussion_r863283873


##########
sdks/python/apache_beam/coders/typecoders.py:
##########
@@ -119,15 +119,21 @@ def register_coder(self, typehint_type, 
typehint_coder_class):
     if typehint_type.__module__ == '__main__':
       # See https://issues.apache.org/jira/browse/BEAM-14250
       # TODO(robertwb): Remove once all runners are portable.
-      typehint_type = str(typehint_type)
+      if hasattr(typehint_type, '__name__'):
+        typehint_type = typehint_type.__name__
+      else:
+        typehint_type = str(typehint_type)
     self._register_coder_internal(typehint_type, typehint_coder_class)
 
   def get_coder(self, typehint):
     # type: (Any) -> coders.Coder
     if typehint and typehint.__module__ == '__main__':
       # See https://issues.apache.org/jira/browse/BEAM-14250
       # TODO(robertwb): Remove once all runners are portable.
-      typehint = str(typehint)
+      if hasattr(typehint, '__name__'):

Review Comment:
   Thanks, will apply it!



-- 
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: github-unsubscr...@beam.apache.org

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

Reply via email to