8000 BUG: Fix ``yield from`` for python 2.7. · numpy/numpy@d4861f2 · GitHub
[go: up one dir, main page]

Skip to content

Commit d4861f2

Browse files
committed
BUG: Fix yield from for python 2.7.
1 parent a88e61f commit d4861f2

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

numpy/lib/histograms.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -922,9 +922,11 @@ def _histogramdd_dispatcher(sample, bins=None, range=None, normed=None,
922922
if hasattr(sample, 'shape'): # same condition as used in histogramdd
923923
yield sample
924924
else:
925-
yield from sample
925+
for s in sample:
926+
yield s
926927
with contextlib.suppress(TypeError):
927-
yield from bins
928+
for b in bins:
929+
yield b
928930
yield weights
929931

930932

numpy/lib/twodim_base.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -574,7 +574,8 @@ def _histogram2d_dispatcher(x, y, bins=None, range=None, normed=None,
574574
except TypeError:
575575
N = 1
576576
if N != 1 and N != 2:
577-
yield from bins # bins=[x, y]
577+
for b in bins:
578+
yield b
578579
else:
579580
yield bins
580581

0 commit comments

Comments
 (0)
0