Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

Make socket binding exceptions more debugable

Abierto
#2,104 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
75/100
Tipo de issue
Nueva funcionalidad
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
python
Área
networking

Línea de trabajo

Read can/interfaces/socketcan/socketcan.py around lines 589-602, starting with the socket.bind((channel,)) call and its surrounding error handling. Verify that binding failures retain the channel context in the OSError, then inspect nearby areas of the python-can codebase for similarly context-free Python errors and check that the resulting exceptions remain useful to client code.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

enhancement
Is your feature request related to a problem? Please describe.

When you hit an OSError, unless you have debug log level tracing enabled your client code may wind up with a bare OSError with little context for what bus was responsible. When more than one bus is involved in your system you're left to disambiguate with some custom code of one's own.

Describe the solution you'd like

I'd like the OSError to have a note added to it with the necessary context to identify what bus channel was involved with the error. A perfect solution would be to augment the logic defined here
https://github.com/hardbyte/python-can/blob/b4f82abede25ff83376be793a2935c41f81c3869/can/interfaces/socketcan/socketcan.py#L589-L602

and replace it with

601c601,607
<     sock.bind((channel,))
---
>     try:
>         sock.bind((channel,))
>     except OSError as exc:
>         exc_msg = f"Error binding socketcan bus at {channel=}"
>         log.exception(exc_msg)
>         exc.add_note(exc_msg)
>         raise
604d609
< 
Describe alternatives you've considered

none

Additional context

Consider any other areas of the python-can codebase that similarly raise naked python errors without context. Those should also benefit by injecting notes with the surrounding context that was being attempted.

Lenguaje dominante
Python
Estrellas
1.6k
Forks
697
Métricas de merge de PR
Sin PR fusionados en 30 d

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de hardbyte/python-can

Todos los issues de hardbyte/python-can

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.