You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by GitBox <gi...@apache.org> on 2020/08/21 16:59:39 UTC

[GitHub] [beam] TheNeuralBit commented on a change in pull request #12654: [BEAM-10766] Fix flake where ByteString coercion could modify cached type hints

TheNeuralBit commented on a change in pull request #12654:
URL: https://github.com/apache/beam/pull/12654#discussion_r474817590



##########
File path: sdks/python/apache_beam/transforms/external.py
##########
@@ -127,17 +127,21 @@ def _get_named_tuple_instance(self):
         for key, value in self._values.items() if value is not None
     }
 
+    # In python 2 named_fields_to_schema will not accept str because its
+    # ambiguous. This converts str hints to ByteString recursively so its clear
+    # we intend to use BYTES.
     # TODO(BEAM-7372): Remove coercion to ByteString
     def coerce_str_to_bytes(typ):
       if typ == str:
         return ByteString
 
       elif hasattr(typ, '__args__'):

Review comment:
       added `hasattr(typ, '__origin__')`




----------------------------------------------------------------
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.

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