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 serhiy.storchaka
Recipients gregory.p.smith, joernheissler, ncoghlan, pmoody, prudvinit, serhiy.storchaka, xiang.zhang
Date 2018-09-11.15:32:58
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1536679978.7.0.0269046726804.issue34465@psf.upfronthosting.co.za>
In-reply-to
Content
See issue27572 for moving in opposite direction. Supporting the buffer protocol rather of just bytes and bytearray complicates the code, and can be considered as a feature creep, especially if an input is a text encoded as bytes.

But in this case the bytes argument of IPv4Address() is not a text representation like b'127.0.0.1', but a packed array of bytes like bytes([127, 0, 0, 1]). Accepting bytearray and memoryview makes more sense for it. Yet I'm not sure that supporting them is worth adding an overhead. This will affect every call of the IPv4Address constructor, and I think that this is not the most common case.

Maybe add a special purposed named constructor IPv4Address.from_bytes() that will accept any objects supporting the buffer protocol?
History
Date User Action Args
2018-09-11 15:32:58serhiy.storchakasetrecipients: + serhiy.storchaka, gregory.p.smith, ncoghlan, pmoody, xiang.zhang, joernheissler, prudvinit
2018-09-11 15:32:58serhiy.storchakasetmessageid: <1536679978.7.0.0269046726804.issue34465@psf.upfronthosting.co.za>
2018-09-11 15:32:58serhiy.storchakalinkissue34465 messages
2018-09-11 15:32:58serhiy.storchakacreate