File: gnu-hurd-getsockname

package info (click to toggle)
mypy 1.15.0-5
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 20,576 kB
  • sloc: python: 105,159; cpp: 11,380; ansic: 6,629; makefile: 247; sh: 20
file content (25 lines) | stat: -rw-r--r-- 858 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
From: Mattias Ellert <mattias.ellert@physics.uu.se>
Date: Fri, 7 Feb 2025 15:44:22 +0100
Subject: [PATCH] GNU/Hurd returns empty string from getsockname() for AF_UNIX
 sockets

Build the socket name from directory name and name instead.
---
 mypy/ipc.py | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/mypy/ipc.py b/mypy/ipc.py
index 991f9ac..b2046a4 100644
--- a/mypy/ipc.py
+++ b/mypy/ipc.py
@@ -303,6 +303,10 @@ class IPCServer(IPCBase):
     def connection_name(self) -> str:
         if sys.platform == "win32":
             return self.name
+        elif sys.platform == "gnu0":
+            # GNU/Hurd returns empty string from getsockname()
+            # for AF_UNIX sockets
+            return os.path.join(self.sock_directory, self.name)
         else:
             name = self.sock.getsockname()
             assert isinstance(name, str)