Skip to content

CI: troubleshoot py310 build #41990

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 10 commits into from
Jun 15, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Troubleshoot py310 build
  • Loading branch information
jbrockmendel committed Jun 14, 2021
commit 03e549ebca6ac1971da3f6477e2757915dbc2058
6 changes: 3 additions & 3 deletions pandas/_libs/algos.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -1030,9 +1030,9 @@ def rank_1d(
if rank_t is object:
nan_fill_val = Infinity()
elif rank_t is int64_t:
nan_fill_val = np.iinfo(np.int64).max
nan_fill_val = util.INT64_MAX
elif rank_t is uint64_t:
nan_fill_val = np.iinfo(np.uint64).max
nan_fill_val = util.UINT64_MAX
else:
nan_fill_val = np.inf
order = (masked_vals, mask, labels)
Expand Down Expand Up @@ -1393,7 +1393,7 @@ def rank_2d(

# int64 and datetimelike
else:
nan_value = np.iinfo(np.int64).max
nan_value = util.INT64_MAX

else:
if rank_t is object:
Expand Down
4 changes: 4 additions & 0 deletions pandas/_libs/lib.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,10 @@ cdef:

float64_t NaN = <float64_t>np.NaN

# python-visible
i8max = INT64_MAX
u8max = UINT64_MAX


@cython.wraparound(False)
@cython.boundscheck(False)
Expand Down
3 changes: 2 additions & 1 deletion pandas/core/util/hashing.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

import numpy as np

from pandas._libs import lib
from pandas._libs.hashing import hash_object_array
from pandas._typing import (
ArrayLike,
Expand Down Expand Up @@ -244,7 +245,7 @@ def _hash_categorical(cat: Categorical, encoding: str, hash_key: str) -> np.ndar
result = np.zeros(len(mask), dtype="uint64")

if mask.any():
result[mask] = np.iinfo(np.uint64).max
result[mask] = lib.u8max

return result

Expand Down
8 changes: 4 additions & 4 deletions pandas/tests/scalar/timedelta/test_timedelta.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import numpy as np
import pytest

from pandas._libs import lib
from pandas._libs.tslibs import (
NaT,
iNaT,
Expand Down Expand Up @@ -391,8 +392,7 @@ def test_round_implementation_bounds(self):
"method", [Timedelta.round, Timedelta.floor, Timedelta.ceil]
)
def test_round_sanity(self, method, n, request):
iinfo = np.iinfo(np.int64)
val = np.random.randint(iinfo.min + 1, iinfo.max, dtype=np.int64)
val = np.random.randint(iNaT + 1, lib.i8max, dtype=np.int64)
td = Timedelta(val)

assert method(td, "ns") == td
Expand Down Expand Up @@ -552,8 +552,8 @@ def test_implementation_limits(self):

# GH 12727
# timedelta limits correspond to int64 boundaries
assert min_td.value == np.iinfo(np.int64).min + 1
assert max_td.value == np.iinfo(np.int64).max
assert min_td.value == iNaT + 1
assert max_td.value == lib.i8max

# Beyond lower limit, a NAT before the Overflow
assert (min_td - Timedelta(1, "ns")) is NaT
Expand Down
5 changes: 3 additions & 2 deletions pandas/tests/scalar/timestamp/test_unary_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@
import pytz
from pytz import utc

from pandas._libs import lib
from pandas._libs.tslibs import (
NaT,
Timedelta,
Timestamp,
conversion,
iNaT,
to_offset,
)
from pandas._libs.tslibs.period import INVALID_FREQ_ERR_MSG
Expand Down Expand Up @@ -279,8 +281,7 @@ def test_round_implementation_bounds(self):
"method", [Timestamp.round, Timestamp.floor, Timestamp.ceil]
)
def test_round_sanity(self, method, n):
iinfo = np.iinfo(np.int64)
val = np.random.randint(iinfo.min + 1, iinfo.max, dtype=np.int64)
val = np.random.randint(iNaT + 1, lib.i8max, dtype=np.int64)
ts = Timestamp(val)

def checker(res, ts, nanos):
Expand Down