diff options
author | Adam Cozzette <acozzette@gmail.com> | 2017-12-01 07:31:37 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-12-01 07:31:37 -0800 |
commit | a711e3d5b4ee1dd7f9d21197dca8432a5819a64e (patch) | |
tree | f594ef198ba98a8860b26b3db6cfcc718222ca19 /python/google | |
parent | 6de51caed52d798815954646b230c5aef3e4d2fc (diff) | |
parent | a27da093393d3dc7301d27fe328284335cb98528 (diff) | |
download | protobuf-a711e3d5b4ee1dd7f9d21197dca8432a5819a64e.tar.gz protobuf-a711e3d5b4ee1dd7f9d21197dca8432a5819a64e.tar.bz2 protobuf-a711e3d5b4ee1dd7f9d21197dca8432a5819a64e.zip |
Merge pull request #3979 from acozzette/3.5.x-merge
Merge 3.5.x branch into master
Diffstat (limited to 'python/google')
-rwxr-xr-x | python/google/protobuf/__init__.py | 2 | ||||
-rw-r--r-- | python/google/protobuf/descriptor_pool.py | 11 |
2 files changed, 11 insertions, 2 deletions
diff --git a/python/google/protobuf/__init__.py b/python/google/protobuf/__init__.py index 9f1a4f19..0f4d63b0 100755 --- a/python/google/protobuf/__init__.py +++ b/python/google/protobuf/__init__.py @@ -30,7 +30,7 @@ # Copyright 2007 Google Inc. All Rights Reserved. -__version__ = '3.4.1' +__version__ = '3.5.0.post1' if __name__ != '__main__': try: diff --git a/python/google/protobuf/descriptor_pool.py b/python/google/protobuf/descriptor_pool.py index cb7146b6..f4c533a4 100644 --- a/python/google/protobuf/descriptor_pool.py +++ b/python/google/protobuf/descriptor_pool.py @@ -127,6 +127,9 @@ class DescriptorPool(object): self._service_descriptors = {} self._file_descriptors = {} self._toplevel_extensions = {} + # TODO(jieluo): Remove _file_desc_by_toplevel_extension after + # maybe year 2020 for compatibility issue (with 3.4.1 only). + self._file_desc_by_toplevel_extension = {} # We store extensions in two two-level mappings: The first key is the # descriptor of the message being extended, the second key is the extension # full name or its tag number. @@ -252,6 +255,12 @@ class DescriptorPool(object): """ self._AddFileDescriptor(file_desc) + # TODO(jieluo): This is a temporary solution for FieldDescriptor.file. + # FieldDescriptor.file is added in code gen. Remove this solution after + # maybe 2020 for compatibility reason (with 3.4.1 only). + for extension in file_desc.extensions_by_name.values(): + self._file_desc_by_toplevel_extension[ + extension.full_name] = file_desc def _AddFileDescriptor(self, file_desc): """Adds a FileDescriptor to the pool, non-recursively. @@ -331,7 +340,7 @@ class DescriptorPool(object): pass try: - return self._toplevel_extensions[symbol].file + return self._file_desc_by_toplevel_extension[symbol] except KeyError: pass |