diff --git a/pandas/_libs/join.pyx b/pandas/_libs/join.pyx index faa7ab95fd28b..f9e1ebb11116b 100644 --- a/pandas/_libs/join.pyx +++ b/pandas/_libs/join.pyx @@ -119,7 +119,8 @@ def left_outer_join(const int64_t[:] left, const int64_t[:] right, right_indexer = _get_result_indexer(right_sorter, right_indexer) if not sort: # if not asked to sort, revert to original order - if len(left) == len(left_indexer): + # cast to avoid build warning GH#26757 + if len(left) == len(left_indexer): # no multiple matches for any row on the left # this is a short-cut to avoid groupsort_indexer # otherwise, the `else` path also works in this case diff --git a/pandas/_libs/ops.pyx b/pandas/_libs/ops.pyx index a86600ef6de9c..27f7016ab4057 100644 --- a/pandas/_libs/ops.pyx +++ b/pandas/_libs/ops.pyx @@ -122,7 +122,7 @@ def vec_compare(object[:] left, object[:] right, object op): ndarray[uint8_t, cast=True] result int flag - if n != len(right): + if n != len(right): raise ValueError('Arrays were different lengths: {n} vs {nright}' .format(n=n, nright=len(right))) @@ -223,7 +223,7 @@ def vec_binop(object[:] left, object[:] right, object op): Py_ssize_t i, n = len(left) object[:] result - if n != len(right): + if n != len(right): raise ValueError('Arrays were different lengths: {n} vs {nright}' .format(n=n, nright=len(right))) diff --git a/pandas/_libs/tslibs/parsing.pyx b/pandas/_libs/tslibs/parsing.pyx index 068ad016459a8..eb99f090e8565 100644 --- a/pandas/_libs/tslibs/parsing.pyx +++ b/pandas/_libs/tslibs/parsing.pyx @@ -8,6 +8,7 @@ from io import StringIO from libc.string cimport strchr import cython +from cython import Py_ssize_t from cpython cimport PyObject_Str, PyUnicode_Join @@ -607,7 +608,8 @@ def try_parse_date_and_time(object[:] dates, object[:] times, object[:] result n = len(dates) - if len(times) != n: + # Cast to avoid build warning see GH#26757 + if len(times) != n: raise ValueError('Length of dates and times must be equal') result = np.empty(n, dtype='O') @@ -643,7 +645,8 @@ def try_parse_year_month_day(object[:] years, object[:] months, object[:] result n = len(years) - if len(months) != n or len(days) != n: + # Cast to avoid build warning see GH#26757 + if len(months) != n or len(days) != n: raise ValueError('Length of years/months/days must all be equal') result = np.empty(n, dtype='O') @@ -668,8 +671,10 @@ def try_parse_datetime_components(object[:] years, double micros n = len(years) - if (len(months) != n or len(days) != n or len(hours) != n or - len(minutes) != n or len(seconds) != n): + # Cast to avoid build warning see GH#26757 + if (len(months) != n or len(days) != n or + len(hours) != n or len(minutes) != n or + len(seconds) != n): raise ValueError('Length of all datetime components must be equal') result = np.empty(n, dtype='O') diff --git a/pandas/_libs/window.pyx b/pandas/_libs/window.pyx index de755ca0245e6..48b554ca02a9d 100644 --- a/pandas/_libs/window.pyx +++ b/pandas/_libs/window.pyx @@ -1827,7 +1827,7 @@ def ewmcov(float64_t[:] input_x, float64_t[:] input_y, Py_ssize_t i, nobs ndarray[float64_t] output - if len(input_y) != N: + if len(input_y) != N: raise ValueError("arrays are of different lengths " "({N} and {len_y})".format(N=N, len_y=len(input_y))) diff --git a/pandas/io/sas/sas.pyx b/pandas/io/sas/sas.pyx index 022c95397b76f..6378198225516 100644 --- a/pandas/io/sas/sas.pyx +++ b/pandas/io/sas/sas.pyx @@ -1,5 +1,6 @@ # cython: profile=False # cython: boundscheck=False, initializedcheck=False +from cython import Py_ssize_t import numpy as np import pandas.io.sas.sas_constants as const @@ -18,8 +19,9 @@ cdef const uint8_t[:] rle_decompress(int result_length, cdef: uint8_t control_byte, x uint8_t[:] result = np.zeros(result_length, np.uint8) - int rpos = 0, ipos = 0, length = len(inbuff) + int rpos = 0 int i, nbytes, end_of_first_byte + Py_ssize_t ipos = 0, length = len(inbuff) while ipos < length: control_byte = inbuff[ipos] & 0xF0 @@ -123,12 +125,13 @@ cdef const uint8_t[:] rdc_decompress(int result_length, cdef: uint8_t cmd uint16_t ctrl_bits, ctrl_mask = 0, ofs, cnt - int ipos = 0, rpos = 0, k + int rpos = 0, k uint8_t[:] outbuff = np.zeros(result_length, dtype=np.uint8) + Py_ssize_t ipos = 0, length = len(inbuff) ii = -1 - while ipos < len(inbuff): + while ipos < length: ii += 1 ctrl_mask = ctrl_mask >> 1 if ctrl_mask == 0: