Skip to content

Commit 2ecfea0

Browse files
committed
test fixes
1 parent 1ba2259 commit 2ecfea0

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

pandas/_libs/src/vendored/numpy/datetime/np_datetime.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,7 @@ npy_datetime npy_datetimestruct_to_datetime(NPY_DATETIMEUNIT base,
435435
const int64_t days = get_datetimestruct_days(dts);
436436
if (days == -1) {
437437
PyGILState_STATE gstate = PyGILState_Ensure();
438-
bool did_error = PyErr_Occurred() ? false : true;
438+
bool did_error = PyErr_Occurred() == NULL ? false : true;
439439
PyGILState_Release(gstate);
440440
if (did_error) {
441441
return -1;

pandas/tests/frame/test_constructors.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3198,8 +3198,11 @@ def test_from_out_of_bounds_ns_datetime(
31983198

31993199
def test_out_of_s_bounds_datetime64(self, constructor):
32003200
scalar = np.datetime64(np.iinfo(np.int64).max, "D")
3201-
with pytest.raises(OverflowError, match="Overflow occurred"):
3202-
constructor(scalar)
3201+
result = constructor(scalar)
3202+
item = get1(result)
3203+
assert type(item) is np.datetime64
3204+
dtype = tm.get_dtype(result)
3205+
assert dtype == object
32033206

32043207
@pytest.mark.parametrize("cls", [timedelta, np.timedelta64])
32053208
def test_from_out_of_bounds_ns_timedelta(

0 commit comments

Comments
 (0)