8000 np.copy should have order='K' by default for backward compatibility · Issue #469 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

np.copy should have order='K' by default for backward compatibility #469

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

Closed
GaelVaroquaux opened this issue Sep 30, 2012 · 5 comments
Closed
Milestone

Comments

@GaelVaroquaux
Copy link
Contributor

In current tree:

>>> a = np.ones((10, 10))
>>> np.copy(a.T).flags
  C_CONTIGUOUS : True
  F_CONTIGUOUS : False
  OWNDATA : True
  WRITEABLE : True
  ALIGNED : True
  UPDATEIFCOPY : False

In numpy 1.6

>>> a = np.ones((10, 10))
>>> np.copy(a.T).flags
  C_CONTIGUOUS : False
  F_CONTIGUOUS : True
  OWNDATA : True
  WRITEABLE : True
  ALIGNED : True
  UPDATEIFCOPY : False

I suggest to put "order='K'" by default in numpy 1.7 (maybe with a FutureWarning) to ensure backward compat.

@charris
Copy link
Member
charris commented Oct 4, 2012

@njsmith I believe you fixed this.

@certik
Copy link
Contributor
certik commented Dec 16, 2012

The current master does:

>>> import numpy as np
>>> a = np.ones((10, 10))
>>> np.copy(a.T).flags
  C_CONTIGUOUS : False
  F_CONTIGUOUS : True
  OWNDATA : True
  WRITEABLE : True
  ALIGNED : True
  UPDATEIFCOPY : False

So I think it's fixed.

@certik
Copy link
Contributor
certik commented Dec 16, 2012

The 1.7.x branch still says however:

>>> import numpy as np
>>> a = np.ones((10, 10))
>>> np.copy(a.T).flags
  C_CONTIGUOUS : True
  F_CONTIGUOUS : False
  OWNDATA : True
  WRITEABLE : True
  ALIGNED : True
  UPDATEIFCOPY : False

So I need to find the commit which fixed it and backport it.

@certik
Copy link
Contributor
certik commented Dec 16, 2012

So I ran:

git bisect start
git bisect bad c5ccca92c5f136833ad85614feb2aa4f5bd8b7c3
git bisect good eb730a50467b9708260f6e2602bf8a8b4a2b1b67
git bisect run ./run.sh

with run.sh:

#! /bin/sh
set -e
python setup.py install
cd /tmp/a
python a.py

and /tmp/a/a.py:

import sys
import numpy as np
a = np.ones((10, 10))
print np.copy(a.T).flags
if np.copy(a.T).flags["F_CONTIGUOUS"] == True:
    print "bisect bad"
    sys.exit(1)
else:
    print "bisect good"
    sys.exit(0)

and it gave 1a71edc as the first "bad" commit (introduced in #476). Pretty cool! I am going to backport it now.

@certik
Copy link
Contributor
certik commented Dec 16, 2012

Backported in #2839.

@certik certik closed this as completed Dec 16, 2012
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

No branches or pull requests

3 participants
0