Skip to content
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

MAINT: Address tuple indexing and warnings #8944

Merged
merged 4 commits into from Jun 25, 2018
Merged

Conversation

larsoner
Copy link
Member

With this PR, I get no warnings in runtests.py. We'll see if the CIs agree.

I also fixed a shadowing of the builtin sorted.

sl[axis] = slice(-(N - 1) // 2, None)
Y[sl] = X[sl]
Y[tuple(sl)] = X[tuple(sl)]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably faster to not call tuple twice here

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think for the code that is executed here the speed difference will be negligible, and I'm not sure it would help readability to assign it to a temp var.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also I suppose numpy was calling tuple twice before anyway internally, so this is not really any slower.

assert_equal(log1p(c(np.nan, 1)), c(np.nan, np.nan))
assert_equal(log1p(c(np.nan, np.nan)), c(np.nan, np.nan))
with suppress_warnings() as sup:
sup.filter(RuntimeWarning, "invalid value encountered in multiply")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't seem to have an associated change in the warning list

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR that was merged before had ignore in the list, which I think caused this (and potentially other) warning(s) to be ignored

@rgommers rgommers added the maintenance Items related to regular maintenance tasks label Jun 25, 2018
@rgommers rgommers added this to the 1.2.0 milestone Jun 25, 2018
@rgommers rgommers merged commit 23bb049 into scipy:master Jun 25, 2018
@rgommers
Copy link
Member

LGTM and all green, so in it goes. Thanks @larsoner, @eric-wieser

@eric-wieser
Copy link
Contributor

Thanks @larsoner for picking up the other half of numpy/numpy#9686 for me!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maintenance Items related to regular maintenance tasks
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants