You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by "AnandInguva (via GitHub)" <gi...@apache.org> on 2023/03/22 15:09:46 UTC
[GitHub] [beam] AnandInguva commented on a diff in pull request #25914: Update gen_protos to work with new protobuf on os-x.
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`.
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: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org