[New-bugs-announce] [issue32562] Support fspath protocol in AF_UNIX sockaddr resolution

Nathaniel Smith report at bugs.python.org
Mon Jan 15 21:23:17 EST 2018

New submission from Nathaniel Smith <njs at pobox.com>:

In 3.6, trying to connect to a AF_UNIX socket using a pathlib.Path object doesn't work:

Python 3.6.4 (default, Dec 27 2017, 13:02:49) 
[GCC 7.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import socket, pathlib
>>> s = socket.socket(family=socket.AF_UNIX)
>>> s.connect(pathlib.Path("asdf"))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: a bytes-like object is required, not 'PosixPath'

It would be good to fix this to use the fspath protocol.

messages: 310034
nosy: brett.cannon, njs
priority: normal
severity: normal
status: open
title: Support fspath protocol in AF_UNIX sockaddr resolution
versions: Python 3.7, Python 3.8

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list