Fix a bazel build error on Windows

This commit is contained in:
Changming Sun 2017-06-22 22:06:56 +08:00
parent 703cd8e11c
commit 4987ddac75
3 changed files with 13 additions and 7 deletions

View File

@ -1055,13 +1055,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),
#else
slice,
#endif
length, &from, &to, &step, &slice_length);
#else
PySlice_GetIndicesEx(
slice,
length, &from, &to, &step, &slice_length);
#endif
if (from < to) {
min = from;
max = to - 1;

View File

@ -266,10 +266,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);

View File

@ -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;