Skip to content

CLN: fix compiler warnings in tzconversion.pyx #27412

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 4 commits into from Jul 16, 2019
Merged
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
9 changes: 6 additions & 3 deletions pandas/_libs/tslibs/tzconversion.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ from dateutil.tz import tzutc

import numpy as np
cimport numpy as cnp
from numpy cimport ndarray, int64_t, uint8_t, intp_t
from numpy cimport ndarray, int64_t, uint8_t, intp_t, npy_bool
cnp.import_array()

from pandas._libs.tslibs.ccalendar import DAY_SECONDS, HOUR_SECONDS
Expand Down Expand Up @@ -65,7 +65,7 @@ timedelta-like}
"""
cdef:
int64_t[:] deltas, idx_shifted, idx_shifted_left, idx_shifted_right
ndarray[uint8_t, cast=True] ambiguous_array, both_nat, both_eq
npy_bool[:] ambiguous_array, both_nat, both_eq
Py_ssize_t i, idx, pos, ntrans, n = len(vals)
Py_ssize_t delta_idx_offset, delta_idx, pos_left, pos_right
int64_t *tdata
Expand All @@ -81,6 +81,8 @@ timedelta-like}
list trans_grp
str stamp

dst_hours = np.empty(0, dtype=np.int64) # silence false-positive compiler warning

# Vectorized version of DstTzInfo.localize
if is_utc(tz) or tz is None:
return vals
Expand Down Expand Up @@ -167,7 +169,8 @@ timedelta-like}
# where result_a != result_b and neither of them are NAT)
both_nat = np.logical_and(result_a != NPY_NAT, result_b != NPY_NAT)
both_eq = result_a == result_b
trans_idx = np.squeeze(np.nonzero(np.logical_and(both_nat, ~both_eq)))
trans_idx = np.squeeze(np.nonzero(np.logical_and(both_nat,
np.logical_not(both_eq))))
if trans_idx.size == 1:
stamp = _render_tstamp(vals[trans_idx])
raise pytz.AmbiguousTimeError(
Expand Down