aboutsummaryrefslogtreecommitdiffhomepage
path: root/python
diff options
context:
space:
mode:
authorGravatar Adam Cozzette <acozzette@google.com>2017-11-30 13:34:51 -0800
committerGravatar Adam Cozzette <acozzette@google.com>2017-11-30 13:34:51 -0800
commita27da093393d3dc7301d27fe328284335cb98528 (patch)
treef594ef198ba98a8860b26b3db6cfcc718222ca19 /python
parent6de51caed52d798815954646b230c5aef3e4d2fc (diff)
parent94bb1eed17209cacfdf2571be5a1ae91b3964cff (diff)
Merge branch '3.5.x' into 3.5.x-merge
Diffstat (limited to 'python')
-rwxr-xr-xpython/google/protobuf/__init__.py2
-rw-r--r--python/google/protobuf/descriptor_pool.py11
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