[issue17683] socket.getsockname() inconsistent return type with AF_UNIX

Giampaolo Rodola' report at bugs.python.org
Wed Apr 10 16:50:35 CEST 2013


Giampaolo Rodola' added the comment:

Note that if we pass bytes to bind(), getsockname() will return str anyway:

>>> s = socket.socket(socket.AF_UNIX)
>>> s.bind(b'hello')
>>> s.getsockname()
'hello'

That said, it seems more consistent to me to return str also in case of abstract namespace. 
As per:
http://blog.eduardofleury.com/archives/2007/09/13
...one is supposed to set only the first byte to null, and the rest of the path is supposed to be a 'plain' string.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue17683>
_______________________________________


More information about the Python-bugs-list mailing list