Skip to content

Commit 10f6f8a

Browse files
committed
add dtype constraint for copy
1 parent 7954a81 commit 10f6f8a

File tree

2 files changed

+2
-7
lines changed

2 files changed

+2
-7
lines changed

pandas/core/arrays/base.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,7 @@
1818
from pandas.util._decorators import Appender, Substitution
1919
from pandas.util._validators import validate_fillna_kwargs
2020

21-
from pandas.core.dtypes.common import (
22-
is_array_like,
23-
is_bool,
24-
is_integer_dtype,
25-
is_list_like,
26-
)
21+
from pandas.core.dtypes.common import is_array_like, is_list_like
2722
from pandas.core.dtypes.dtypes import ExtensionDtype
2823
from pandas.core.dtypes.generic import ABCExtensionArray, ABCIndexClass, ABCSeries
2924
from pandas.core.dtypes.missing import isna

pandas/core/arrays/integer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ def coerce_to_array(values, dtype, mask=None, copy=False):
197197
return values, mask
198198

199199
values = np.asarray(values, dtype=getattr(values, "dtype", object))
200-
if copy:
200+
if copy and hasattr(values, dtype):
201201
values = values.copy()
202202

203203
if is_object_dtype(values):

0 commit comments

Comments
 (0)