Skip to content

BLD: fix build warnings #26757

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Jun 12, 2019
5 changes: 3 additions & 2 deletions pandas/_libs/join.pyx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import cython
from cython import Py_ssize_t
from cython import Py_ssize_t, size_t

import numpy as np
cimport numpy as cnp
Expand Down Expand Up @@ -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
if len(left) == <size_t>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
Expand Down
6 changes: 3 additions & 3 deletions pandas/_libs/ops.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ from cpython cimport (PyObject_RichCompareBool,
Py_EQ, Py_NE, Py_LT, Py_LE, Py_GT, Py_GE)

import cython
from cython import Py_ssize_t
from cython import Py_ssize_t, size_t

import numpy as np
from numpy cimport ndarray, uint8_t, import_array
Expand Down Expand Up @@ -118,7 +118,7 @@ def vec_compare(object[:] left, object[:] right, object op):
result : ndarray[bool]
"""
cdef:
Py_ssize_t i, n = len(left)
size_t i, n = len(left)
ndarray[uint8_t, cast=True] result
int flag

Expand Down Expand Up @@ -220,7 +220,7 @@ def vec_binop(object[:] left, object[:] right, object op):
result : ndarray[object]
"""
cdef:
Py_ssize_t i, n = len(left)
size_t i, n = len(left)
object[:] result

if n != len(right):
Expand Down
7 changes: 4 additions & 3 deletions pandas/_libs/tslibs/parsing.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ from io import StringIO
from libc.string cimport strchr

import cython
from cython import size_t, Py_ssize_t

from cpython cimport PyObject_Str, PyUnicode_Join

Expand Down Expand Up @@ -603,7 +604,7 @@ def try_parse_date_and_time(object[:] dates, object[:] times,
date_parser=None, time_parser=None,
dayfirst=False, default=None):
cdef:
Py_ssize_t i, n
size_t i, n
object[:] result

n = len(dates)
Expand Down Expand Up @@ -639,7 +640,7 @@ def try_parse_date_and_time(object[:] dates, object[:] times,
def try_parse_year_month_day(object[:] years, object[:] months,
object[:] days):
cdef:
Py_ssize_t i, n
size_t i, n
object[:] result

n = len(years)
Expand All @@ -661,7 +662,7 @@ def try_parse_datetime_components(object[:] years,
object[:] seconds):

cdef:
Py_ssize_t i, n
size_t i, n
object[:] result
int secs
double float_secs
Expand Down
4 changes: 2 additions & 2 deletions pandas/_libs/window.pyx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# cython: boundscheck=False, wraparound=False, cdivision=True

import cython
from cython import Py_ssize_t
from cython import Py_ssize_t, size_t
from libcpp.deque cimport deque

from libc.stdlib cimport malloc, free
Expand Down Expand Up @@ -1821,7 +1821,7 @@ def ewmcov(float64_t[:] input_x, float64_t[:] input_y,
"""

cdef:
Py_ssize_t N = len(input_x)
size_t N = len(input_x)
float64_t alpha, old_wt_factor, new_wt, mean_x, mean_y, cov
float64_t sum_wt, sum_wt2, old_wt, cur_x, cur_y, old_mean_x, old_mean_y
Py_ssize_t i, nobs
Expand Down
7 changes: 5 additions & 2 deletions pandas/io/sas/sas.pyx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# cython: profile=False
# cython: boundscheck=False, initializedcheck=False
from cython import size_t

import numpy as np
import pandas.io.sas.sas_constants as const
Expand All @@ -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
size_t ipos = 0, length = len(inbuff)

while ipos < length:
control_byte = inbuff[ipos] & 0xF0
Expand Down Expand Up @@ -123,8 +125,9 @@ 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)
size_t ipos = 0

ii = -1

Expand Down