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 2 commits
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
14 changes: 8 additions & 6 deletions pandas/core/algorithms.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import numpy as np

from pandas._libs import (
Timestamp,
algos,
hashtable as htable,
iNaT,
Expand Down Expand Up @@ -1092,18 +1093,19 @@ def checked_add_with_arr(
# it is negative, we then check whether its sum with the element in
# 'arr' exceeds np.iinfo(np.int64).min. If so, we have an overflow
# error as well.
i8max = Timestamp.max.value # GH#?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can u make these consistent across all of the files

iow this is called different names but the same even in this change set

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will standardize in next commit. this kludge really shouldn't be necessary

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok ping when ready.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ping, will be nice to finally get back to green

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

right what i mean was can you standardize these names (you mostly do, but some are CAPITAL and some not). prefer to do it in this PR as going to backport.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the ones in .py files are all i8max, u8max, or iNaT

i8min = iNaT

mask1 = b2 > 0
mask2 = b2 < 0

if not mask1.any():
to_raise = ((np.iinfo(np.int64).min - b2 > arr) & not_nan).any()
to_raise = ((i8min - b2 > arr) & not_nan).any()
elif not mask2.any():
to_raise = ((np.iinfo(np.int64).max - b2 < arr) & not_nan).any()
to_raise = ((i8max - b2 < arr) & not_nan).any()
else:
to_raise = (
(np.iinfo(np.int64).max - b2[mask1] < arr[mask1]) & not_nan[mask1]
).any() or (
(np.iinfo(np.int64).min - b2[mask2] > arr[mask2]) & not_nan[mask2]
to_raise = ((i8max - b2[mask1] < arr[mask1]) & not_nan[mask1]).any() or (
(i8min - b2[mask2] > arr[mask2]) & not_nan[mask2]
).any()

if to_raise:
Expand Down
4 changes: 2 additions & 2 deletions pandas/core/arrays/_ranges.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def _generate_range_overflow_safe(
# GH#14187 raise instead of incorrectly wrapping around
assert side in ["start", "end"]

i64max = np.uint64(np.iinfo(np.int64).max)
i64max = np.uint64(Timestamp.max.value) # GH#???
msg = f"Cannot generate range with {side}={endpoint} and periods={periods}"

with np.errstate(over="raise"):
Expand Down Expand Up @@ -180,7 +180,7 @@ def _generate_range_overflow_safe_signed(
# error: Incompatible types in assignment (expression has type
# "unsignedinteger[_64Bit]", variable has type "signedinteger[_64Bit]")
result = np.uint64(endpoint) + np.uint64(addend) # type: ignore[assignment]
i64max = np.uint64(np.iinfo(np.int64).max)
i64max = np.uint64(Timestamp.max.value)
assert result > i64max
if result <= i64max + np.uint64(stride):
# error: Incompatible return value type (got "unsignedinteger", expected
Expand Down
6 changes: 3 additions & 3 deletions pandas/core/nanops.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ def _get_fill_value(
else:
if fill_value_typ == "+inf":
# need the max int here
return np.iinfo(np.int64).max
return Timedelta.max.value # GH#???
else:
return iNaT

Expand Down Expand Up @@ -376,7 +376,7 @@ def _wrap_results(result, dtype: np.dtype, fill_value=None):
result = np.nan

# raise if we have a timedelta64[ns] which is too large
if np.fabs(result) > np.iinfo(np.int64).max:
if np.fabs(result) > Timedelta.max.value:
raise ValueError("overflow in timedelta operation")

result = Timedelta(result, unit="ns")
Expand Down Expand Up @@ -1758,7 +1758,7 @@ def na_accum_func(values: ArrayLike, accum_func, *, skipna: bool) -> ArrayLike:
if accum_func == np.minimum.accumulate:
# Note: the accum_func comparison fails as an "is" comparison
y = values.view("i8")
y[mask] = np.iinfo(np.int64).max
y[mask] = Timedelta.max.value
changed = True
else:
y = values
Expand Down
3 changes: 2 additions & 1 deletion pandas/core/sorting.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import numpy as np

from pandas._libs import (
Timestamp,
algos,
hashtable,
lib,
Expand Down Expand Up @@ -40,7 +41,7 @@
from pandas import MultiIndex
from pandas.core.indexes.base import Index

_INT64_MAX = np.iinfo(np.int64).max
_INT64_MAX = Timestamp.max.value # GH#?


def get_indexer_indexer(
Expand Down