[Bug]: `socket.socketpair()` uses the loopback fallback and rejects `AF_UNIX`
Mantenedores costumam responder em até 1 dia
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 4/5
- Tempo estimado
- 3-5 dias
- Facilidade para iniciantes
- 35/100
- Tipo de issue
- Bug
- Clareza
- Claramente especificada
- Status de atividade
- Ativa
- Domínio
- backend, networking
Direção de pesquisa
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.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
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.
- Linguagem predominante
- Python
- Estrelas
- 1.7k
- Forks
- 167
- Merge médio
- 3d 11h
- PRs com merge (30d)
- 68
Preparar o ambiente
Inicia o contêiner de desenvolvimento do projeto no navegador, com a sua própria conta do GitHub.
- Sem Dockerfile nem arquivo Docker Compose
- Sem modelo de pull request
- Ler o guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de oracle/graalpython
-
bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 74/100
oracle/graalpython#1105 ·
Mantenedores costumam responder em até 1 dia
-
bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
oracle/graalpython#1102 ·
Mantenedores costumam responder em até 1 dia
-
mmap.mmap.move() is missingTalvez já em andamento @deronnax assumiu há 3 dias. Aberta
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 62/100
oracle/graalpython#1368 ·
Mantenedores costumam responder em até 1 dia
-
mmap extended slicing ignores the step; negative steps raise java.lang.IndexOutOfBoundsExceptionAberta
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 64/100
oracle/graalpython#1367 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 22/100
oracle/graalpython#1366 ·
Mantenedores costumam responder em até 1 dia
Todas as issues de oracle/graalpython
Issues semelhantes
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
Mantenedores costumam responder em até 1 dia
-
bug improve content
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 92/100
opensafely/documentation#2102 ·
Mantenedores costumam responder em até 1 dia
-
difficulty:1 documentation
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 82/100
MakazhanAlpamys/Soup#3533 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 74/100
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 76/100
onyx-dot-app/onyx#18730 ·
Mantenedores costumam responder em até 1 dia