Skip to content

Commit 15a9739

Browse files
authored
BUG: Use isinstance for is_iterator on Cygwin
Fixes pandas-dev#45158 Keep original implementation if not on Cygwin, and choose the implementation at compile time to avoid performance hits from the extra branch. [Test results on Cygwin are available are available here](https://github.com/DWesl/pandas/runs/5648361139?check_suite_focus=true)
1 parent 5414a2d commit 15a9739

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

pandas/_libs/lib.pyx

+4-1
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,10 @@ def is_iterator(obj: object) -> bool:
268268
>>> is_iterator(1)
269269
False
270270
"""
271-
return PyIter_Check(obj)
271+
IF UNAME_SYSNAME.startswith("CYGWIN"):
272+
return isinstance(obj, abc.Iterator)
273+
ELSE:
274+
return PyIter_Check(obj)
272275

273276

274277
def item_from_zerodim(val: object) -> object:

0 commit comments

Comments
 (0)