Skip to content

Commit 2243252

Browse files
committed
BUG: Fix Index.putmask not to make stack overflow with an invalid mask
1 parent 1798c9d commit 2243252

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

pandas/core/indexes/base.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1934,7 +1934,10 @@ def putmask(self, mask, value):
19341934
try:
19351935
np.putmask(values, mask, self._convert_for_op(value))
19361936
return self._shallow_copy(values)
1937-
except (ValueError, TypeError):
1937+
except (ValueError, TypeError) as err:
1938+
if is_object_dtype(self):
1939+
raise err
1940+
19381941
# coerces to object
19391942
return self.astype(object).putmask(mask, value)
19401943

0 commit comments

Comments
 (0)