[Bug]: `socket.socketpair()` uses the loopback fallback and rejects `AF_UNIX`
Maintainer antworten meist innerhalb von 1 Tag
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Anfängerfreundlichkeit
- 35/100
- Issue-Typ
- Bug
- Klarheit
- Klar beschrieben
- Aktivitätsstatus
- Aktiv
- Bereich
- backend, networking
Rechercherichtung
Start with SocketModuleBuiltins.java, where _socket lacks a socketpair entry, and the socket.py fallback _fallback_socketpair that rejects non-AF_INET families. Compare with the native socket implementation in PosixSupport.java to see how a new socketpair(family, type, proto) would be wired into the POSIX backends and the emulated one. Done when socket.socketpair(socket.AF_UNIX) returns two AF_UNIX sockets and hasattr(_socket, 'socketpair') is True.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
Describe the bug
_socket has no socketpair, so socket.socketpair() falls back to connecting two AF_INET sockets over loopback: it rejects AF_UNIX with ValueError and returns AF_INET sockets by default. CPython on POSIX calls the native socketpair and defaults to AF_UNIX.
Operating system
macOS
CPU architecture
ARM64
GraalPy version
master 3289197e63 (Python 3.13.14), built with mx python-jvm
JDK version
No response
Context configuration
No response
Steps to reproduce
import socket, _socket
| Expression | GraalPy | CPython |
|---|---|---|
socket.socketpair(socket.AF_UNIX) |
ValueError: Only AF_INET and AF_INET6 socket address families are supported |
(<socket.socket fd=3, family=1, type=1, proto=0>, <socket.socket fd=4, family=1, type=1, proto=0>) |
socket.socketpair()[0].family |
<AddressFamily.AF_INET: 2> |
<AddressFamily.AF_UNIX: 1> |
hasattr(_socket, 'socketpair') |
False |
True |
Expected behavior
The CPython column above (3.12.13 and 3.13.14).
Stack trace
Additional context
Root Cause
SocketModuleBuiltins has no socketpair, so socket.py takes _fallback_socketpair, which connects two AF_INET sockets over loopback and rejects other families. On POSIX CPython provides _socket.socketpair and defaults to AF_UNIX. GraalPy can create AF_UNIX sockets with socket.socket.
Fix Suggestion
Add socketpair(family, type, proto) to PosixSupport and its backends, next to socket, and expose it as _socket.socketpair in SocketModuleBuiltins, returning two PSocket objects. The emulated backend can raise the unsupported-feature error it already raises for AF_UNIX.
- Vorherrschende Sprache
- Python
- Sterne
- 1.7k
- Forks
- 167
- Ø Merge
- 3 T. 11 Std.
- Gemergte PRs (30 T.)
- 68
Entwicklungsumgebung
Startet den Dev-Container des Projekts im Browser, mit Ihrem eigenen GitHub-Konto.
- Kein Dockerfile und keine Docker-Compose-Datei
- Keine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus oracle/graalpython
-
bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 74/100
oracle/graalpython#1105 ·
Maintainer antworten meist innerhalb von 1 Tag
-
bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
oracle/graalpython#1102 ·
Maintainer antworten meist innerhalb von 1 Tag
-
mmap.mmap.move() is missingEvtl. vergeben @deronnax hat das vor 3 Tagen übernommen. Offen
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 62/100
oracle/graalpython#1368 ·
Maintainer antworten meist innerhalb von 1 Tag
-
mmap extended slicing ignores the step; negative steps raise java.lang.IndexOutOfBoundsExceptionOffen
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 64/100
oracle/graalpython#1367 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 22/100
oracle/graalpython#1366 ·
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in oracle/graalpython
Ähnliche Issues
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
Maintainer antworten meist innerhalb von 1 Tag
-
bug improve content
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 92/100
opensafely/documentation#2102 ·
Maintainer antworten meist innerhalb von 1 Tag
-
difficulty:1 documentation
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
MakazhanAlpamys/Soup#3533 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 74/100
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 76/100
onyx-dot-app/onyx#18730 ·
Maintainer antworten meist innerhalb von 1 Tag