diff options
author | Jisi Liu <jisi.liu@gmail.com> | 2017-07-25 11:52:33 -0700 |
---|---|---|
committer | Jisi Liu <jisi.liu@gmail.com> | 2017-07-25 11:52:33 -0700 |
commit | 759245a49a00315a41b28da8fe52a2894d4f57ea (patch) | |
tree | 5a0032a1a3619a448d5301da131907ca8449730f /python | |
parent | 4bff88e0fb2338657a781eeee0c5362a57b57bf3 (diff) | |
download | protobuf-759245a49a00315a41b28da8fe52a2894d4f57ea.tar.gz protobuf-759245a49a00315a41b28da8fe52a2894d4f57ea.tar.bz2 protobuf-759245a49a00315a41b28da8fe52a2894d4f57ea.zip |
Merge from master
Diffstat (limited to 'python')
-rw-r--r-- | python/google/protobuf/pyext/message.cc | 6 | ||||
-rw-r--r-- | python/google/protobuf/pyext/repeated_composite_container.cc | 3 | ||||
-rw-r--r-- | python/google/protobuf/pyext/repeated_scalar_container.cc | 7 | ||||
-rwxr-xr-x | python/setup.py | 1 |
4 files changed, 12 insertions, 5 deletions
diff --git a/python/google/protobuf/pyext/message.cc b/python/google/protobuf/pyext/message.cc index 41c3f78d..702c5d03 100644 --- a/python/google/protobuf/pyext/message.cc +++ b/python/google/protobuf/pyext/message.cc @@ -1056,13 +1056,15 @@ int InternalDeleteRepeatedField( if (PySlice_Check(slice)) { from = to = step = slice_length = 0; - PySlice_GetIndicesEx( #if PY_MAJOR_VERSION < 3 + PySlice_GetIndicesEx( reinterpret_cast<PySliceObject*>(slice), + length, &from, &to, &step, &slice_length); #else + PySlice_GetIndicesEx( slice, -#endif length, &from, &to, &step, &slice_length); +#endif if (from < to) { min = from; max = to - 1; diff --git a/python/google/protobuf/pyext/repeated_composite_container.cc b/python/google/protobuf/pyext/repeated_composite_container.cc index cb083c68..5ad71db5 100644 --- a/python/google/protobuf/pyext/repeated_composite_container.cc +++ b/python/google/protobuf/pyext/repeated_composite_container.cc @@ -270,10 +270,11 @@ int AssignSubscript(RepeatedCompositeContainer* self, if (PySlice_Check(slice)) { #if PY_MAJOR_VERSION >= 3 if (PySlice_GetIndicesEx(slice, + length, &from, &to, &step, &slicelength) == -1) { #else if (PySlice_GetIndicesEx(reinterpret_cast<PySliceObject*>(slice), -#endif length, &from, &to, &step, &slicelength) == -1) { +#endif return -1; } return PySequence_DelSlice(self->child_messages, from, to); diff --git a/python/google/protobuf/pyext/repeated_scalar_container.cc b/python/google/protobuf/pyext/repeated_scalar_container.cc index c93d9982..54998800 100644 --- a/python/google/protobuf/pyext/repeated_scalar_container.cc +++ b/python/google/protobuf/pyext/repeated_scalar_container.cc @@ -305,10 +305,12 @@ static PyObject* Subscript(RepeatedScalarContainer* self, PyObject* slice) { length = Len(self); #if PY_MAJOR_VERSION >= 3 if (PySlice_GetIndicesEx(slice, + length, &from, &to, &step, &slicelength) == -1) { #else if (PySlice_GetIndicesEx(reinterpret_cast<PySliceObject*>(slice), -#endif length, &from, &to, &step, &slicelength) == -1) { + +#endif return NULL; } return_list = true; @@ -458,10 +460,11 @@ static int AssSubscript(RepeatedScalarContainer* self, length = reflection->FieldSize(*message, field_descriptor); #if PY_MAJOR_VERSION >= 3 if (PySlice_GetIndicesEx(slice, + length, &from, &to, &step, &slicelength) == -1) { #else if (PySlice_GetIndicesEx(reinterpret_cast<PySliceObject*>(slice), -#endif length, &from, &to, &step, &slicelength) == -1) { +#endif return -1; } create_list = true; diff --git a/python/setup.py b/python/setup.py index a2026706..70b7de5c 100755 --- a/python/setup.py +++ b/python/setup.py @@ -80,6 +80,7 @@ def GenerateUnittestProtos(): generate_proto("../src/google/protobuf/any_test.proto", False) generate_proto("../src/google/protobuf/map_unittest.proto", False) generate_proto("../src/google/protobuf/test_messages_proto3.proto", False) + generate_proto("../src/google/protobuf/test_messages_proto2.proto", False) generate_proto("../src/google/protobuf/unittest_arena.proto", False) generate_proto("../src/google/protobuf/unittest_no_arena.proto", False) generate_proto("../src/google/protobuf/unittest_no_arena_import.proto", False) |