8000 fix: Remove check for Protobuf version by parthea · Pull Request #474 · googleapis/proto-plus-python · GitHub
[go: up one dir, main page]

Skip to content

fix: Remove check for Protobuf version #474

New issue

Have a question about this project? Sign up for a 8000 free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jul 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 5 additions & 9 deletions proto/marshal/compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@
# not be included.

from google.protobuf.internal import containers
import google.protobuf

PROTOBUF_VERSION = google.protobuf.__version__

# Import protobuf 4.xx first and fallback to earlier version
# if not present.
Expand Down Expand Up @@ -51,13 +48,12 @@
repeated_composite_types += (_message.RepeatedCompositeContainer,)
repeated_scalar_types += (_message.RepeatedScalarContainer,)

# In `proto/marshal.py`, for compatibility with protobuf 5.x,
# we'll use `map_composite_type_names` to check whether
# the name of the class of a protobuf type is
# `MessageMapContainer`, and, if `True`, return a MapComposite.
# See https://github.com/protocolbuffers/protobuf/issues/16596
if PROTOBUF_VERSION[0:2] in ["3.", "4."]:
try:
map_composite_types += (_message.MessageMapContainer,)
except AttributeError:
# The `MessageMapContainer` attribute is not available in Protobuf 5.x+
pass


__all__ = (
"repeated_composite_types",
Expand Down
0