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


##########
sdks/python/gen_protos.py:
##########
@@ -123,7 +123,19 @@ 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
+  try:
+    from google._upb import _message
+    list_types = (
+        list,
+        _message.RepeatedScalarContainer,
+        _message.RepeatedCompositeContainer,
+    )  # pylint: disable=c-extension-no-member
+  except ImportError:
+    from google.protobuf.internal import containers

Review Comment:
   Yes, that would be helpful.  I haven't caught this error while i was using 
when `PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=upb`(which is default).
    but when `PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION==python`(slow 
implementation of protobufs which we don't want to use)  I was using  `except` 
case.



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