Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Make socket binding exceptions more debugable

オープン
#2,104 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
75/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
活発
技術スタック
python
領域
networking

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

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.

主要言語
Python
スター
1.6k
フォーク
697
PR マージ指標
30日以内にマージされた PR はありません

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

hardbyte/python-can のほかの issue

hardbyte/python-can の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。