diff --git a/pandas/_libs/hashtable_func_helper.pxi.in b/pandas/_libs/hashtable_func_helper.pxi.in index c63f368dfae43..326ae36c6a12c 100644 --- a/pandas/_libs/hashtable_func_helper.pxi.in +++ b/pandas/_libs/hashtable_func_helper.pxi.in @@ -84,7 +84,8 @@ cpdef value_count_{{dtype}}({{c_type}}[:] values, bint dropna): int64_t[:] result_counts {{endif}} - Py_ssize_t k + # Don't use Py_ssize_t, since table.n_buckets is unsigned + khiter_t k table = kh_init_{{ttype}}() {{if dtype == 'object'}} @@ -132,7 +133,8 @@ def duplicated_{{dtype}}(const {{c_type}}[:] values, object keep='first'): {{if dtype != 'object'}} {{dtype}}_t value {{endif}} - Py_ssize_t k, i, n = len(values) + Py_ssize_t i, n = len(values) + khiter_t k kh_{{ttype}}_t *table = kh_init_{{ttype}}() ndarray[uint8_t, ndim=1, cast=True] out = np.empty(n, dtype='bool') @@ -222,7 +224,8 @@ def ismember_{{dtype}}(const {{c_type}}[:] arr, {{c_type}}[:] values): boolean ndarry len of (arr) """ cdef: - Py_ssize_t i, n, k + Py_ssize_t i, n + khiter_t k int ret = 0 ndarray[uint8_t] result {{c_type}} val @@ -295,7 +298,8 @@ def mode_{{dtype}}({{ctype}}[:] values, bint dropna): cdef: int count, max_count = 1 int j = -1 # so you can do += - Py_ssize_t k + # Don't use Py_ssize_t, since table.n_buckets is unsigned + khiter_t k kh_{{table_type}}_t *table ndarray[{{ctype}}] modes diff --git a/pandas/_libs/src/parser/tokenizer.c b/pandas/_libs/src/parser/tokenizer.c index 7ba1a6cd398c9..a195c0daf5271 100644 --- a/pandas/_libs/src/parser/tokenizer.c +++ b/pandas/_libs/src/parser/tokenizer.c @@ -709,7 +709,7 @@ int skip_this_line(parser_t *self, int64_t rownum) { } int tokenize_bytes(parser_t *self, - size_t line_limit, int64_t start_lines) { + size_t line_limit, uint64_t start_lines) { int64_t i; uint64_t slen; int should_skip; @@ -1348,7 +1348,7 @@ int parser_trim_buffers(parser_t *self) { int _tokenize_helper(parser_t *self, size_t nrows, int all) { int status = 0; - int64_t start_lines = self->lines; + uint64_t start_lines = self->lines; if (self->state == FINISHED) { return 0; diff --git a/pandas/_libs/tslibs/period.pyx b/pandas/_libs/tslibs/period.pyx index 9757c4d36d5fa..aadf2c41f7941 100644 --- a/pandas/_libs/tslibs/period.pyx +++ b/pandas/_libs/tslibs/period.pyx @@ -76,7 +76,7 @@ from pandas._libs.tslibs.tzconversion cimport tz_convert_utc_to_tzlocal cdef: enum: - INT32_MIN = -2_147_483_648 + INT32_MIN = -2_147_483_648LL ctypedef struct asfreq_info: @@ -108,9 +108,11 @@ cdef extern from *: #define FR_UND -10000 /* Undefined */ // must use npy typedef b/c int64_t is aliased in cython-generated c + // unclear why we need LL for that row. + // see https://github.com/pandas-dev/pandas/pull/34416/ static npy_int64 daytime_conversion_factor_matrix[7][7] = { {1, 24, 1440, 86400, 86400000, 86400000000, 86400000000000}, - {0, 1, 60, 3600, 3600000, 3600000000, 3600000000000}, + {0LL, 1LL, 60LL, 3600LL, 3600000LL, 3600000000LL, 3600000000000LL}, {0, 0, 1, 60, 60000, 60000000, 60000000000}, {0, 0, 0, 1, 1000, 1000000, 1000000000}, {0, 0, 0, 0, 1, 1000, 1000000},