mirror of
https://github.com/python/cpython.git
synced 2025-11-25 04:34:37 +00:00
Issue #1008086: Fixes socket.inet_aton() to always return 4 bytes even
on LP64 platforms (most 64-bit Linux, bsd, unix systems).
This commit is contained in:
parent
bcd3ea86a3
commit
3605b5cee3
3 changed files with 19 additions and 2 deletions
|
|
@ -388,6 +388,14 @@ class GeneralModuleTests(unittest.TestCase):
|
|||
# Check that setting it to an invalid type raises TypeError
|
||||
self.assertRaises(TypeError, socket.setdefaulttimeout, "spam")
|
||||
|
||||
def testIPv4_inet_aton_fourbytes(self):
|
||||
if not hasattr(socket, 'inet_aton'):
|
||||
return # No inet_aton, nothing to check
|
||||
# Test that issue1008086 and issue767150 are fixed.
|
||||
# It must return 4 bytes.
|
||||
self.assertEquals('\x00'*4, socket.inet_aton('0.0.0.0'))
|
||||
self.assertEquals('\xff'*4, socket.inet_aton('255.255.255.255'))
|
||||
|
||||
def testIPv4toString(self):
|
||||
if not hasattr(socket, 'inet_pton'):
|
||||
return # No inet_pton() on this platform
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue