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 mattrobenolt
Recipients mattrobenolt
Date 2016-07-25.06:27:53
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1469428074.1.0.701366093272.issue27612@psf.upfronthosting.co.za>
In-reply-to
Content
This also affects socket.getaddrinfo on macOS only, but is fine on Linux. I've not tested on Windows to see behavior there.

Given the IP address `0177.0000.0000.0001`, which is a valid octal format representing `127.0.0.1`, we can see varying results. Confirmed in both python 2.7 and 3.5.

First, socket.gethostbyname is always wrong, and always returns `177.0.0.1`:

```
>>> socket.gethostbyname('0177.0000.0000.0001')
'177.0.0.1'
```

This can be seen on both Linux and macOS.

With `socket.getaddrinfo`, resolution is correct on Linux, but the bad 177.0.0.1 on macOS.

Linux:
```
>>> socket.getaddrinfo('0177.0000.0000.0001', None)[0]
(2, 1, 6, '', ('127.0.0.1', 0))
```

macOS:
```
>>> socket.getaddrinfo('0177.0000.0000.0001', None)[0]
(2, 2, 17, '', ('177.0.0.1', 0))
```

This behavior exists in both 2.7.12 and 3.5.2 at least. I haven't tested many others, but I assume pretty universal.
History
Date User Action Args
2016-07-25 06:27:54mattrobenoltsetrecipients: + mattrobenolt
2016-07-25 06:27:54mattrobenoltsetmessageid: <1469428074.1.0.701366093272.issue27612@psf.upfronthosting.co.za>
2016-07-25 06:27:54mattrobenoltlinkissue27612 messages
2016-07-25 06:27:53mattrobenoltcreate