Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 64b9ece

Browse files
NelleVQuLogic
authored andcommitted
Merge pull request #8331 from anntzer/dont-use-__builtins__
Don't index into __builtins__ (not supported by PyPy).
1 parent a538693 commit 64b9ece

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

lib/matplotlib/axes/_axes.py

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6062,6 +6062,10 @@ def hist(self, x, bins=None, range=None, normed=False, weights=None,
60626062
.. plot:: mpl_examples/statistics/histogram_demo_features.py
60636063
60646064
"""
6065+
# Avoid shadowing the builtin.
6066+
bin_range = range
6067+
del range
6068+
60656069
def _normalize_input(inp, ename='input'):
60666070
"""Normalize 1 or 2d input into list of np.ndarray or
60676071
a single 2D np.ndarray.
@@ -6106,13 +6110,6 @@ def _normalize_input(inp, ename='input'):
61066110
if bins is None:
61076111
bins = rcParams['hist.bins']
61086112

6109-
# xrange becomes range after 2to3
6110-
bin_range = range
6111-
range = __builtins__["range"]
6112-
6113-
# NOTE: the range keyword overwrites the built-in func range !!!
6114-
# needs to be fixed in numpy !!!
6115-
61166113
# Validate string inputs here so we don't have to clutter
61176114
# subsequent code.
61186115
if histtype not in ['bar', 'barstacked', 'step', 'stepfilled']:
@@ -6478,10 +6475,7 @@ def hist2d(self, x, y, bins=10, range=None, normed=False, weights=None,
64786475
.. plot:: mpl_examples/pylab_examples/hist2d_demo.py
64796476
"""
64806477

6481-
# xrange becomes range after 2to3
6482-
bin_range = range
6483-
range = __builtins__["range"]
6484-
h, xedges, yedges = np.histogram2d(x, y, bins=bins, range=bin_range,
6478+
h, xedges, yedges = np.histogram2d(x, y, bins=bins, range=range,
64856479
normed=normed, weights=weights)
64866480

64876481
if cmin is not None:

0 commit comments

Comments
 (0)