[issue34465] ipaddress should accept bytearray in addition to bytes

2018-09-11 Thread Jörn Heissler
Jörn Heissler added the comment: > Maybe add a special purposed named constructor IPv4Address.from_bytes() that > will accept any objects supporting the buffer protocol? That would work for me. I wonder if there should be something like ipaddress.ip_address_from_bytes too that can construct

[issue34465] ipaddress should accept bytearray in addition to bytes

2018-09-11 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: 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

[issue34465] ipaddress should accept bytearray in addition to bytes

2018-09-10 Thread Gregory P. Smith
Gregory P. Smith added the comment: This isn't limited to just IPv4Address, the Network classes and the IPv6 classes that accept bytes should also be updated for consistency if we're going to do this. (bytes, bytearray, memoryview) make sense to support, and explicitly test in unittests.

[issue34465] ipaddress should accept bytearray in addition to bytes

2018-08-31 Thread Xiang Zhang
Xiang Zhang added the comment: I'm -1 on this change. I think the workaround is easy and direct. -- ___ Python tracker ___ ___

[issue34465] ipaddress should accept bytearray in addition to bytes

2018-08-25 Thread Jörn Heissler
Jörn Heissler added the comment: That's what I'm doing now. But it would be more convenient if I could pass a bytearray. -- ___ Python tracker ___

[issue34465] ipaddress should accept bytearray in addition to bytes

2018-08-25 Thread Xiang Zhang
Xiang Zhang added the comment: Why not just bytes(buf[:4]) before passing? -- nosy: +xiang.zhang ___ Python tracker ___ ___

[issue34465] ipaddress should accept bytearray in addition to bytes

2018-08-25 Thread Jörn Heissler
Jörn Heissler added the comment: My use case is parsing binary data. For that I use a bytearray as a buffer. buf[:4] gets me another bytearray which I'd want to convert to an ipaddress. I can't think of a usecase for list-of-int. -- ___ Python

[issue34465] ipaddress should accept bytearray in addition to bytes

2018-08-25 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: What is your use case? New features can be added only in the developed version. -- nosy: +ncoghlan, pmoody, serhiy.storchaka versions: -Python 3.4, Python 3.5, Python 3.6, Python 3.7 ___ Python tracker

[issue34465] ipaddress should accept bytearray in addition to bytes

2018-08-24 Thread Prudvi RajKumar Maddala
Change by Prudvi RajKumar Maddala : -- keywords: +patch pull_requests: +8379 stage: -> patch review ___ Python tracker ___ ___

[issue34465] ipaddress should accept bytearray in addition to bytes

2018-08-23 Thread Prudvi RajKumar Maddala
Prudvi RajKumar Maddala added the comment: I think it should be supported too. How about a list of bytes? eg : [127,0,0,1].. Should that be supported as well? -- nosy: +prudvinit ___ Python tracker

[issue34465] ipaddress should accept bytearray in addition to bytes

2018-08-22 Thread Jörn Heissler
New submission from Jörn Heissler : Hi, the ipaddress module accepts `bytes' objects in the constructors. `bytearray' however is not supported, see paste below. Should this be supported too? >>> import ipaddress >>> ipaddress.IPv4Address(bytes([127, 0, 0, 1])) IPv4Address('127.0.0.1') >>>