This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author skrah
Recipients Arfrever, christian.heimes, georg.brandl, loewis, mark.dickinson, meador.inge, ncoghlan, pitrou, python-dev, skrah, vstinner
Date 2012-08-12.09:37:42
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <20120812093743.GA32417@sleipnir.bytereef.org>
In-reply-to <1344721571.39.0.0129155211751.issue15573@psf.upfronthosting.co.za>
Content
Martin v. L??wis <report@bugs.python.org> wrote:
> Here is a more formal definition of my last proposal,
> 
> v and w are equal iff
> v.shape() == w.shape() and
>   ((v.format == w.format and v.tobytes() == w.tobytes()) or
>    v.tolist() == w.tolist())
> if tolist raises an exception for unsupported codes, they are not equal

This wouldn't solve the NaN problem though:

>>> nd = ndarray([(1,2)], shape=[1], format='dd', flags=ND_WRITABLE)
>>> nd[0] = (float('nan'), float('nan'))
>>> m = memoryview(nd)
>>> m == nd
True

What's the policy on importing modules in the Object/* hierarchy? Can we
import _struct?

The current unpack_cmp() function for identical single native format codes
is very fast. The only thing that would be needed to make it general is
to replace

   default: return -1;

with

   default: return unpack_cmp_struct();

The code is already there in _testbuffer.c. _testbuffer.c itself has 100%
code coverage (including all error conditions with a special patch).

This means that all tests are already present in test_buffer.py.
History
Date User Action Args
2012-08-12 09:37:43skrahsetrecipients: + skrah, loewis, georg.brandl, mark.dickinson, ncoghlan, pitrou, vstinner, christian.heimes, Arfrever, meador.inge, python-dev
2012-08-12 09:37:43skrahlinkissue15573 messages
2012-08-12 09:37:42skrahcreate