yeandy commented on code in PR #17278:
URL: https://github.com/apache/beam/pull/17278#discussion_r842898174
##########
sdks/python/apache_beam/coders/typecoders.py:
##########
@@ -116,10 +116,18 @@ def register_coder(self, typehint_type,
typehint_coder_class):
'Received %r instead.' % typehint_coder_class)
if typehint_type not in self.custom_types:
self.custom_types.append(typehint_type)
+ if typehint_type.__module__ == '__main__':
Review Comment:
Seems to be failures if `typehint_type` is None
```suggestion
if typehint and typehint_type.__module__ == '__main__':
```
##########
sdks/python/apache_beam/coders/typecoders.py:
##########
@@ -116,10 +116,18 @@ def register_coder(self, typehint_type,
typehint_coder_class):
'Received %r instead.' % typehint_coder_class)
if typehint_type not in self.custom_types:
self.custom_types.append(typehint_type)
+ 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)
self._register_coder_internal(typehint_type, typehint_coder_class)
def get_coder(self, typehint):
# type: (Any) -> coders.Coder
+ if typehint.__module__ == '__main__':
Review Comment:
```suggestion
if typehint and typehint.__module__ == '__main__':
```
--
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]