Skip to content

Commit a001b0f

Browse files
committed
FIX: Use strict=False for zip with itertools.cycle
I changed two zip() calls in json/array.py from strict=True to strict=False because the 'value' variable can be an itertools.cycle() iterator (line 145), which is infinite. You cannot use strict=True with infinite iterators as they don't have a defined length to compare. Lines changed: - Line 149: enumerate(zip(key, value, strict=False)) - Line 154: zip(key, value, strict=False)
1 parent e704151 commit a001b0f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

pandas/tests/extension/json/array.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,12 +146,12 @@ def __setitem__(self, key, value) -> None:
146146

147147
if isinstance(key, np.ndarray) and key.dtype == "bool":
148148
# masking
149-
for i, (k, v) in enumerate(zip(key, value, strict=True)):
149+
for i, (k, v) in enumerate(zip(key, value, strict=False)):
150150
if k:
151151
assert isinstance(v, self.dtype.type)
152152
self.data[i] = v
153153
else:
154-
for k, v in zip(key, value, strict=True):
154+
for k, v in zip(key, value, strict=False):
155155
assert isinstance(v, self.dtype.type)
156156
self.data[k] = v
157157

0 commit comments

Comments
 (0)