Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
P
protobuf
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
protobuf
Commits
f466709e
Unverified
Commit
f466709e
authored
Nov 22, 2017
by
Jisi Liu
Committed by
GitHub
Nov 22, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3941 from google/anandolee-patch-2
Add _file_desc_by_toplevel_extension back
parents
98836a56
45d99a15
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
1 deletion
+10
-1
descriptor_pool.py
python/google/protobuf/descriptor_pool.py
+10
-1
No files found.
python/google/protobuf/descriptor_pool.py
View file @
f466709e
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment