_socket: `socket.sethostname()` reports a failed buffer export as an OS error, raising `SystemError`
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 25/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- python
- Área
- networking
Línea de trabajo
Start by running the reproducer, which calls socket.sethostname() with a bytes subclass whose buffer raises KeyError, and note the SystemError it produces. The body links PR gh-161684, so check that PR before starting, since the work may already be under way. Done means the original exception propagates to the caller instead of being reported as a SystemError, and a test covers that case.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Bug report
Summary
socket.sethostname() accepts a bytes subclass, and if getting a buffer from that object fails, the error is not reported. Instead SystemError is returned to caller.
SystemError: <class 'OSError'> returned a result with an exception set
Reproducer
import os
import socket
class B(bytes):
def __buffer__(self, flags):
raise KeyError("boom")
try:
os.stat("/nonexistent")
except OSError:
pass
socket.sethostname(B(b"h"))
Traceback (most recent call last):
File "min.py", line 23, in <module>
socket.sethostname(B(b"h"))
~~~~~~~~~~~~~~~~~~^^^^^^^^^
SystemError: <class 'OSError'> returned a result with an exception set
CPython versions tested on:
3.15
Operating systems tested on:
Linux
Linked PRs
- gh-161684
- Lenguaje dominante
- Python
- Estrellas
- 78.2k
- Forks
- 36.6k
- Merge medio
- 19 h 57 min
- PR fusionados (30 d)
- 630
Preparar el entorno
Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de python/cpython
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
stdlib type-bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
Los mantenedores suelen responder en 1 día
-
extension-modules stdlib topic-XML type-bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
python/cpython#161807 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
stdlib type-feature
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
python/cpython#161788 · 7 comentarios ·
Los mantenedores suelen responder en 1 día
-
extension-modules topic-IO type-bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
Los mantenedores suelen responder en 1 día
Todos los issues de python/cpython
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
cpp-best-practices/project_validator#267 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Project-N-E-K-O/N.E.K.O#3725 ·
Los mantenedores suelen responder en 1 día
-
[Bug] Sending a Telegram message chain twice duplicates mentionsPosiblemente ocupada @123XieC la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
AstrBotDevs/AstrBot#11125 ·
Los mantenedores suelen responder en 1 día
-
backend bug priority: high
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
nooriegarg/ContribIQ#73 ·
Los mantenedores suelen responder en 1 día
-
bug p3 security
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
amd/gaia#8197 · 2 comentarios ·
Los mantenedores suelen responder en 1 día