Skip to content

Commit

Permalink
CLN: Exception in _libs (pandas-dev#28967)
Browse files Browse the repository at this point in the history
  • Loading branch information
jbrockmendel authored and proost committed Dec 19, 2019
1 parent 914d434 commit a7d5a52
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 10 deletions.
4 changes: 2 additions & 2 deletions pandas/_libs/intervaltree.pxi.in
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ cdef class IntervalTree(IntervalMixin):

# TODO: write get_indexer_intervals
cdef:
size_t old_len
Py_ssize_t old_len
Py_ssize_t i
Int64Vector result

Expand All @@ -179,7 +179,7 @@ cdef class IntervalTree(IntervalMixin):
the given array of scalar targets. Non-unique positions are repeated.
"""
cdef:
size_t old_len
Py_ssize_t old_len
Py_ssize_t i
Int64Vector result, missing

Expand Down
5 changes: 3 additions & 2 deletions pandas/_libs/lib.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -2072,7 +2072,7 @@ def maybe_convert_objects(ndarray[object] objects, bint try_float=0,
floats[i] = float(val)
complexes[i] = complex(val)
seen.float_ = 1
except Exception:
except (ValueError, TypeError):
seen.object_ = 1
break
else:
Expand Down Expand Up @@ -2352,7 +2352,8 @@ def to_object_array_tuples(rows: object):
row = rows[i]
for j in range(len(row)):
result[i, j] = row[j]
except Exception:
except TypeError:
# e.g. "Expected tuple, got list"
# upcast any subclasses to tuple
for i in range(n):
row = (rows[i],) if checknull(rows[i]) else tuple(rows[i])
Expand Down
2 changes: 1 addition & 1 deletion pandas/_libs/tslibs/parsing.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,7 @@ def try_parse_dates(object[:] values, parser=None,
else:
result[i] = parse_date(values[i])
except Exception:
# failed
# Since parser is user-defined, we can't guess what it migh raise
return values
else:
parse_date = parser
Expand Down
7 changes: 2 additions & 5 deletions pandas/_libs/tslibs/timezones.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -226,11 +226,8 @@ cdef object get_dst_info(object tz):
if treat_tz_as_pytz(tz):
trans = np.array(tz._utc_transition_times, dtype='M8[ns]')
trans = trans.view('i8')
try:
if tz._utc_transition_times[0].year == 1:
trans[0] = NPY_NAT + 1
except Exception:
pass
if tz._utc_transition_times[0].year == 1:
trans[0] = NPY_NAT + 1
deltas = unbox_utcoffsets(tz._transition_info)
typ = 'pytz'

Expand Down

0 comments on commit a7d5a52

Please sign in to comment.