瀏覽代碼

Fix a bazel build error on Windows

Changming Sun 8 年之前
父節點
當前提交
4987ddac75

+ 4 - 2
python/google/protobuf/pyext/message.cc

@@ -1055,13 +1055,15 @@ int InternalDeleteRepeatedField(
 
 
   if (PySlice_Check(slice)) {
   if (PySlice_Check(slice)) {
     from = to = step = slice_length = 0;
     from = to = step = slice_length = 0;
-    PySlice_GetIndicesEx(
 #if PY_MAJOR_VERSION < 3
 #if PY_MAJOR_VERSION < 3
+    PySlice_GetIndicesEx(
         reinterpret_cast<PySliceObject*>(slice),
         reinterpret_cast<PySliceObject*>(slice),
+        length, &from, &to, &step, &slice_length);
 #else
 #else
+    PySlice_GetIndicesEx(
         slice,
         slice,
-#endif
         length, &from, &to, &step, &slice_length);
         length, &from, &to, &step, &slice_length);
+#endif
     if (from < to) {
     if (from < to) {
       min = from;
       min = from;
       max = to - 1;
       max = to - 1;

+ 2 - 1
python/google/protobuf/pyext/repeated_composite_container.cc

@@ -266,10 +266,11 @@ int AssignSubscript(RepeatedCompositeContainer* self,
     if (PySlice_Check(slice)) {
     if (PySlice_Check(slice)) {
 #if PY_MAJOR_VERSION >= 3
 #if PY_MAJOR_VERSION >= 3
       if (PySlice_GetIndicesEx(slice,
       if (PySlice_GetIndicesEx(slice,
+                               length, &from, &to, &step, &slicelength) == -1) {
 #else
 #else
       if (PySlice_GetIndicesEx(reinterpret_cast<PySliceObject*>(slice),
       if (PySlice_GetIndicesEx(reinterpret_cast<PySliceObject*>(slice),
-#endif
                                length, &from, &to, &step, &slicelength) == -1) {
                                length, &from, &to, &step, &slicelength) == -1) {
+#endif
         return -1;
         return -1;
       }
       }
       return PySequence_DelSlice(self->child_messages, from, to);
       return PySequence_DelSlice(self->child_messages, from, to);

+ 5 - 2
python/google/protobuf/pyext/repeated_scalar_container.cc

@@ -305,10 +305,12 @@ static PyObject* Subscript(RepeatedScalarContainer* self, PyObject* slice) {
     length = Len(self);
     length = Len(self);
 #if PY_MAJOR_VERSION >= 3
 #if PY_MAJOR_VERSION >= 3
     if (PySlice_GetIndicesEx(slice,
     if (PySlice_GetIndicesEx(slice,
+                             length, &from, &to, &step, &slicelength) == -1) {
 #else
 #else
     if (PySlice_GetIndicesEx(reinterpret_cast<PySliceObject*>(slice),
     if (PySlice_GetIndicesEx(reinterpret_cast<PySliceObject*>(slice),
-#endif
                              length, &from, &to, &step, &slicelength) == -1) {
                              length, &from, &to, &step, &slicelength) == -1) {
+
+#endif
       return NULL;
       return NULL;
     }
     }
     return_list = true;
     return_list = true;
@@ -458,10 +460,11 @@ static int AssSubscript(RepeatedScalarContainer* self,
     length = reflection->FieldSize(*message, field_descriptor);
     length = reflection->FieldSize(*message, field_descriptor);
 #if PY_MAJOR_VERSION >= 3
 #if PY_MAJOR_VERSION >= 3
     if (PySlice_GetIndicesEx(slice,
     if (PySlice_GetIndicesEx(slice,
+                             length, &from, &to, &step, &slicelength) == -1) {
 #else
 #else
     if (PySlice_GetIndicesEx(reinterpret_cast<PySliceObject*>(slice),
     if (PySlice_GetIndicesEx(reinterpret_cast<PySliceObject*>(slice),
-#endif
                              length, &from, &to, &step, &slicelength) == -1) {
                              length, &from, &to, &step, &slicelength) == -1) {
+#endif
       return -1;
       return -1;
     }
     }
     create_list = true;
     create_list = true;