Message 238329 - Python tracker

Message238329

Author serhiy.storchaka
Recipients serhiy.storchaka, vstinner, wolma
Date 2015-03-17.18:41:39
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1426617699.21.0.00532244107233.issue23688@psf.upfronthosting.co.za>
In-reply-to
Content
You patch is correct Wolfgang, but with cast('B') the patch would be smaller (no need to replace len(data) to nbytes).

While we are here, it is possible to add the support of general byte-like objects.

if not isinstance(data, bytes):
    data = memoryview(data).cast('B')

isinstance() check is just for optimization, it can be omitted if doesn't affect a performance.
History
Date User Action Args
2015-03-17 18:41:39serhiy.storchakasetrecipients: + serhiy.storchaka, vstinner, wolma
2015-03-17 18:41:39serhiy.storchakasetmessageid: <1426617699.21.0.00532244107233.issue23688@psf.upfronthosting.co.za>
2015-03-17 18:41:39serhiy.storchakalinkissue23688 messages
2015-03-17 18:41:39serhiy.storchakacreate