Skip to content

Commit a8bcd0f

Browse files
committed
BUG: Replace isinstance with issubclass in _ensure_type (pandas-dev#31925)
Commit pandas-dev/pandas@6fd326d in pull request pandas-dev#30613 added `_ensure_type`, which utilizes `isinstance`. However, it is reasonable to assume that someone may want to create a DataFrame subclass. Therefore, `_ensure_type` should use `issubclass`.
1 parent d33b002 commit a8bcd0f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

pandas/core/base.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ def _ensure_type(self: T, obj) -> T:
9393
9494
Used by type checkers.
9595
"""
96-
assert isinstance(obj, type(self)), type(obj)
96+
assert issubclass(type(obj), type(self)), type(obj)
9797
return obj
9898

9999

0 commit comments

Comments
 (0)