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
5db5c26a
Commit
5db5c26a
authored
Jul 31, 2019
by
Gaël Delalleau
Committed by
Jie Luo
Jul 31, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix a Python extension crash in the descriptor's nested types container code (#6455)
parent
f38b6ed0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
0 deletions
+8
-0
descriptor_test.py
python/google/protobuf/internal/descriptor_test.py
+7
-0
descriptor_containers.cc
python/google/protobuf/pyext/descriptor_containers.cc
+1
-0
No files found.
python/google/protobuf/internal/descriptor_test.py
View file @
5db5c26a
...
...
@@ -650,6 +650,13 @@ class GeneratedDescriptorTest(unittest.TestCase):
del
enum
self
.
assertEqual
(
'FOO'
,
next
(
values_iter
)
.
name
)
def
testDescriptorNestedTypesContainer
(
self
):
message_descriptor
=
unittest_pb2
.
TestAllTypes
.
DESCRIPTOR
nested_message_descriptor
=
unittest_pb2
.
TestAllTypes
.
NestedMessage
.
DESCRIPTOR
self
.
assertEqual
(
len
(
message_descriptor
.
nested_types
),
3
)
self
.
assertFalse
(
None
in
message_descriptor
.
nested_types
)
self
.
assertTrue
(
nested_message_descriptor
in
message_descriptor
.
nested_types
)
def
testServiceDescriptor
(
self
):
service_descriptor
=
unittest_pb2
.
DESCRIPTOR
.
services_by_name
[
'TestService'
]
self
.
assertEqual
(
service_descriptor
.
name
,
'TestService'
)
...
...
python/google/protobuf/pyext/descriptor_containers.cc
View file @
5db5c26a
...
...
@@ -639,6 +639,7 @@ int Find(PyContainer* self, PyObject* item) {
// the .proto file definition.
const
void
*
descriptor_ptr
=
PyDescriptor_AsVoidPtr
(
item
);
if
(
descriptor_ptr
==
NULL
)
{
PyErr_Clear
();
// Not a descriptor, it cannot be in the list.
return
-
1
;
}
...
...
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