Skip to content

Commit 1cad9e5

Browse files
Build fixes for 32 bit MacPython (#34416)
* Fixup 32-bit build
1 parent cb244ed commit 1cad9e5

File tree

3 files changed

+14
-8
lines changed

3 files changed

+14
-8
lines changed

pandas/_libs/hashtable_func_helper.pxi.in

+8-4
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,8 @@ cpdef value_count_{{dtype}}({{c_type}}[:] values, bint dropna):
8484
int64_t[:] result_counts
8585
{{endif}}
8686

87-
Py_ssize_t k
87+
# Don't use Py_ssize_t, since table.n_buckets is unsigned
88+
khiter_t k
8889

8990
table = kh_init_{{ttype}}()
9091
{{if dtype == 'object'}}
@@ -132,7 +133,8 @@ def duplicated_{{dtype}}(const {{c_type}}[:] values, object keep='first'):
132133
{{if dtype != 'object'}}
133134
{{dtype}}_t value
134135
{{endif}}
135-
Py_ssize_t k, i, n = len(values)
136+
Py_ssize_t i, n = len(values)
137+
khiter_t k
136138
kh_{{ttype}}_t *table = kh_init_{{ttype}}()
137139
ndarray[uint8_t, ndim=1, cast=True] out = np.empty(n, dtype='bool')
138140

@@ -222,7 +224,8 @@ def ismember_{{dtype}}(const {{c_type}}[:] arr, {{c_type}}[:] values):
222224
boolean ndarry len of (arr)
223225
"""
224226
cdef:
225-
Py_ssize_t i, n, k
227+
Py_ssize_t i, n
228+
khiter_t k
226229
int ret = 0
227230
ndarray[uint8_t] result
228231
{{c_type}} val
@@ -295,7 +298,8 @@ def mode_{{dtype}}({{ctype}}[:] values, bint dropna):
295298
cdef:
296299
int count, max_count = 1
297300
int j = -1 # so you can do +=
298-
Py_ssize_t k
301+
# Don't use Py_ssize_t, since table.n_buckets is unsigned
302+
khiter_t k
299303
kh_{{table_type}}_t *table
300304
ndarray[{{ctype}}] modes
301305

pandas/_libs/src/parser/tokenizer.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -709,7 +709,7 @@ int skip_this_line(parser_t *self, int64_t rownum) {
709709
}
710710

711711
int tokenize_bytes(parser_t *self,
712-
size_t line_limit, int64_t start_lines) {
712+
size_t line_limit, uint64_t start_lines) {
713713
int64_t i;
714714
uint64_t slen;
715715
int should_skip;
@@ -1348,7 +1348,7 @@ int parser_trim_buffers(parser_t *self) {
13481348

13491349
int _tokenize_helper(parser_t *self, size_t nrows, int all) {
13501350
int status = 0;
1351-
int64_t start_lines = self->lines;
1351+
uint64_t start_lines = self->lines;
13521352

13531353
if (self->state == FINISHED) {
13541354
return 0;

pandas/_libs/tslibs/period.pyx

+4-2
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ from pandas._libs.tslibs.tzconversion cimport tz_convert_utc_to_tzlocal
7676

7777
cdef:
7878
enum:
79-
INT32_MIN = -2_147_483_648
79+
INT32_MIN = -2_147_483_648LL
8080

8181

8282
ctypedef struct asfreq_info:
@@ -108,9 +108,11 @@ cdef extern from *:
108108
#define FR_UND -10000 /* Undefined */
109109
110110
// must use npy typedef b/c int64_t is aliased in cython-generated c
111+
// unclear why we need LL for that row.
112+
// see https://github.com/pandas-dev/pandas/pull/34416/
111113
static npy_int64 daytime_conversion_factor_matrix[7][7] = {
112114
{1, 24, 1440, 86400, 86400000, 86400000000, 86400000000000},
113-
{0, 1, 60, 3600, 3600000, 3600000000, 3600000000000},
115+
{0LL, 1LL, 60LL, 3600LL, 3600000LL, 3600000000LL, 3600000000000LL},
114116
{0, 0, 1, 60, 60000, 60000000, 60000000000},
115117
{0, 0, 0, 1, 1000, 1000000, 1000000000},
116118
{0, 0, 0, 0, 1, 1000, 1000000},

0 commit comments

Comments
 (0)