AnandInguva commented on code in PR #25919: URL: https://github.com/apache/beam/pull/25919#discussion_r1144974776
########## 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 + list_types = ( + list, + containers.RepeatedScalarFieldContainer, + containers.RepeatedCompositeFieldContainer) Review Comment: I think even with older protobuf, we would need `google.protobuf.pyext._message` when `PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION==cpp` but we might need `google.protobuf.internal.containers` when `PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python`. commented at https://github.com/apache/beam/pull/25914#discussion_r1144970641 -- 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]
