robertwb commented on code in PR #25914:
URL: https://github.com/apache/beam/pull/25914#discussion_r1145200453


##########
sdks/python/gen_protos.py:
##########
@@ -123,8 +123,21 @@ def generate_urn_files(out_dir, api_path):
   This is executed at build time rather than dynamically on import to ensure
   that it is compatible with static type checkers like mypy.
   """
-  from google._upb import _message
   from google.protobuf import message
+  from google.protobuf.internal import api_implementation
+  if api_implementation.Type() == 'python':
+    from google.protobuf.internal import containers as impl
+  elif api_implementation.Type() == 'upb':
+    from google._upb import _message as impl
+  elif api_implementation.Type() == 'cpp':
+    import google.protobuf.pyext._message as impl
+  else:
+    raise TypeError(
+        "Unknown proto implementation: " + api_implementation.Type())
+  repeated_types = (
+      list,
+      impl.RepeatedScalarFieldContainer,

Review Comment:
   Oh, good point. Fixed. 



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