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.

作者 skrah
收信人 pitrou, skrah
日期 2011-08-24.19:09:57
SpamBayes Score 2.2134955e-05
Marked as misclassified
Message-id <20110824190713.GA23660@sleipnir.bytereef.org>
In-reply-to <1314211614.4.0.474562959359.issue12834@psf.upfronthosting.co.za>
内容
Antoine Pitrou <report@bugs.python.org> wrote:
> That's rather funky. What should the right result be?

Basically [5, 4, 3, 2, 1] as bytes:

'\x05\x04\x03\x02\x01'

Looks like an off-by-one error.

I was a bit surprised that tobytes() automatically converts anything
to a C-contiguous array. The result can be completely disconnected
from the raw memory.

[The bug also exists for forward strides.]

array([1, 3, 5], dtype=uint64)
>>> m = memoryview(y)
>>> m.tobytes()
'\x03\x00\x00\x00\x00\x00\x00\x00\x05\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00'
>>>
历史
日期 用户 动作 参数
2011-08-24 19:09:59skrah修改recipients: + skrah, pitrou
2011-08-24 19:09:57skrah链接issue12834 messages
2011-08-24 19:09:57skrah创建