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
9e9ca4b6
Commit
9e9ca4b6
authored
Dec 02, 2014
by
Feng Xiao
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #105 from xfxyjwf/fix_92
Fix Python C++ implementation build issues
parents
e559b51b
d1ec493a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
5 deletions
+9
-5
descriptor.cc
python/google/protobuf/pyext/descriptor.cc
+8
-4
setup.py
python/setup.py
+1
-1
No files found.
python/google/protobuf/pyext/descriptor.cc
View file @
9e9ca4b6
...
...
@@ -247,8 +247,10 @@ PyDescriptorPool* NewDescriptorPool() {
}
static
void
Dealloc
(
PyDescriptorPool
*
self
)
{
for
(
auto
it
:
(
*
self
->
classes_by_descriptor
))
{
Py_DECREF
(
it
.
second
);
typedef
PyDescriptorPool
::
ClassesByMessageMap
::
iterator
iterator
;
for
(
iterator
it
=
self
->
classes_by_descriptor
->
begin
();
it
!=
self
->
classes_by_descriptor
->
end
();
++
it
)
{
Py_DECREF
(
it
->
second
);
}
delete
self
->
classes_by_descriptor
;
Py_TYPE
(
self
)
->
tp_free
(
reinterpret_cast
<
PyObject
*>
(
self
));
...
...
@@ -300,7 +302,8 @@ const google::protobuf::Descriptor* RegisterMessageClass(
return
NULL
;
}
Py_INCREF
(
message_class
);
auto
ret
=
self
->
classes_by_descriptor
->
insert
(
typedef
PyDescriptorPool
::
ClassesByMessageMap
::
iterator
iterator
;
std
::
pair
<
iterator
,
bool
>
ret
=
self
->
classes_by_descriptor
->
insert
(
make_pair
(
message_descriptor
,
message_class
));
if
(
!
ret
.
second
)
{
// Update case: DECREF the previous value.
...
...
@@ -323,7 +326,8 @@ const google::protobuf::Descriptor* RegisterMessageClass(
// Retrieve the message class added to our database.
PyObject
*
GetMessageClass
(
PyDescriptorPool
*
self
,
const
Descriptor
*
message_descriptor
)
{
auto
ret
=
self
->
classes_by_descriptor
->
find
(
message_descriptor
);
typedef
PyDescriptorPool
::
ClassesByMessageMap
::
iterator
iterator
;
iterator
ret
=
self
->
classes_by_descriptor
->
find
(
message_descriptor
);
if
(
ret
==
self
->
classes_by_descriptor
->
end
())
{
PyErr_Format
(
PyExc_TypeError
,
"No message class registered for '%s'"
,
message_descriptor
->
full_name
().
c_str
());
...
...
python/setup.py
View file @
9e9ca4b6
...
...
@@ -157,7 +157,7 @@ if __name__ == '__main__':
"google/protobuf/pyext/repeated_scalar_container.cc"
,
"google/protobuf/pyext/repeated_composite_container.cc"
],
define_macros
=
[(
'GOOGLE_PROTOBUF_HAS_ONEOF'
,
'1'
)],
include_dirs
=
[
"."
,
"../src"
],
include_dirs
=
[
"."
,
"..
"
,
"..
/src"
],
libraries
=
[
"protobuf"
],
library_dirs
=
[
'../src/.libs'
],
))
...
...
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