Skip to content

[MRG+1] Fix the behavior of astype copy=True #4555

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

Merged
merged 2 commits into from
Apr 11, 2015

Conversation

ogrisel
Copy link
Member

@ogrisel ogrisel commented Apr 9, 2015

The astype backport should copy memory by default to be consistent with the default behavior of recent numpy.

@@ -103,7 +103,7 @@ def divide(x1, x2, out=None, dtype=None):
except TypeError:
# Compat where astype accepted no copy argument
Copy link
Member

Choose a reason for hiding this comment

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

Does travis contain the old version?

Copy link
Member

Choose a reason for hiding this comment

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

It seems it does.

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 so. I don't have a numpy 1.6.1 at hand right now to quickly check.

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 did the check on numpy 1.6.1 with docker. numpy 1.6.1 is the version of numpy shipped with Ubuntu 12.04 and that is the oldest version of numpy supported by sklearn) and I got:

>>> a.astype(np.float32, copy=False)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: astype() takes no keyword arguments

we have a travis config for that. So this case is properly tested.

@amueller
Copy link
Member

amueller commented Apr 9, 2015

Apart from my comment LGTM.

@ogrisel ogrisel changed the title [MRG] Fix the behavior of astype copy=true [MRG+1] Fix the behavior of astype copy=true Apr 9, 2015
@ogrisel ogrisel changed the title [MRG+1] Fix the behavior of astype copy=true [MRG+1] Fix the behavior of astype copy=True Apr 9, 2015
@ogrisel ogrisel force-pushed the fix-astype-copy-true branch from 91fac5a to 95fb92b Compare April 9, 2015 14:48
@ogrisel
Copy link
Member Author

ogrisel commented Apr 9, 2015

@amueller I forced pushed a change to use a is test.

@amueller
Copy link
Member

amueller commented Apr 9, 2015

Cool. LGTM.

@ogrisel
Copy link
Member Author

ogrisel commented Apr 9, 2015

@jnothman any time for a quick review on this tiny tiny fix on your code?

@ogrisel
Copy link
Member Author

ogrisel commented Apr 11, 2015

Random ping to get this fix in @arjoly @glouppe @mblondel @pprett @agramfort @GaelVaroquaux.

@jnothman
Copy link
Member

LGTM! Thanks for the fix :s

jnothman added a commit that referenced this pull request Apr 11, 2015
[MRG] Fix the behavior of astype copy=True
@jnothman jnothman merged commit 58dfb3d into scikit-learn:master Apr 11, 2015
@ogrisel
Copy link
Member Author

ogrisel commented Apr 11, 2015

Thanks :)

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

Successfully merging this pull request may close these issues.

3 participants