diff options
author | Pauli Virtanen <pav@iki.fi> | 2010-02-20 18:03:36 +0000 |
---|---|---|
committer | Pauli Virtanen <pav@iki.fi> | 2010-02-20 18:03:36 +0000 |
commit | f0fb3132896af12210cfb3aa17eb6f3bfc43af64 (patch) | |
tree | a508350ee30a6d085058f3759a6044736ddb28f0 /numpy/compat/py3k.py | |
parent | 60387a80f67dd2589c5ad4178219e4873417e877 (diff) | |
download | numpy-f0fb3132896af12210cfb3aa17eb6f3bfc43af64.tar.gz |
ENH: rewrite PEP 3118 interface without adding items to structs
Implementing PEP 3118 is somewhat convoluted because of the desirata:
- Don't add new members to ndarray or descr structs, to preserve binary
compatibility. (Also, adding the items is actually not very useful,
since mutability issues prevent an 1 to 1 relationship between arrays
and buffer views.)
- Don't use bf_releasebuffer, because it prevents PyArg_ParseTuple("s#", ...)
from working. Breaking this would cause several backward compatibility
issues already on Python 2.6.
- Behave correctly when array is reshaped in-place, or it's dtype is
altered.
This commit works around these issues by keeping copies of buffer format
strings and shape/stride information in a global dictionary. Elements in
the dictionary are reused when possible, and cleared when an array is
deallocated.
Diffstat (limited to 'numpy/compat/py3k.py')
0 files changed, 0 insertions, 0 deletions