-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Don't index into __builtins__ (not supported by PyPy). #8331
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@@ -6147,13 +6147,6 @@ def _normalize_input(inp, ename='input'): | |||
if bins is None: | |||
bins = rcParams['hist.bins'] | |||
|
|||
# xrange becomes range after 2to3 | |||
bin_range = range |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have a slight preference for
bin_range = range
del range
It causes less code churn and keeps the code below clearer
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sounds reasonable, fixed
dd45300
to
0519ea3
Compare
lib/matplotlib/axes/_axes.py
Outdated
@@ -6147,12 +6147,9 @@ def _normalize_input(inp, ename='input'): | |||
if bins is None: | |||
bins = rcParams['hist.bins'] | |||
|
|||
# xrange becomes range after 2to3 | |||
# Avoid shadowing the builtin. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a lot of code between the argument definition and the renaming here; I think this really should be the first thing in the function to avoid any and all possible shadowing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sounds reasonable, fixed.
0519ea3
to
7eee4c2
Compare
Thanks @anntzer ! |
Don't index into __builtins__ (not supported by PyPy).
Backported to |
cf #8330.