Wrong signature for `KafkaError`'s 1st parameter in `.pyi`

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

メンテナーはふだん 3 日以内に返信

@wgu9 がすでに取り組んでいます。

2026年6月14日 から。

  • #2278 @wgu9 による — オープン

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
70/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
静か
技術スタック
c, python

調査の方向性

src/confluent_kafka/cimpl.pyi の KafkaError 宣言と、src/confluent_kafka/src/confluent_kafka.c のコンストラクター処理を比較します。報告されている mypy コマンドと Python コマンドで不一致を再現し、選択したシグネチャが型チェックと実行時の両方で一貫して受け入れられることを確認します。

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

説明

The name of the 1st parameter for KafkaError's initialiser in src/confluent_kafka/cimpl.pyi is now code (ref here), however this does not match the underlying code itself.

For example, if we try to create an instance of KafkaError according to the signature:

# kafka_error_test.py

from confluent_kafka import KafkaError

error = KafkaError(code=1)

Then mypy is OK with this

# mypy kafka_error_test.py 
Success: no issues found in 1 source file

But we get a TypeError when it runs

# python kafka_error_test.py 
Traceback (most recent call last):
  File "/workspaces/kafka_error_test.py", line 5, in <module>
    error = KafkaError(code=1)

I'm happy to submit a PR to fix this but which way do we want to go here? Change the signature in the .pyi file so it matches what the underlying C code expects? Or change the underlying C code to match up with the signature?

主要言語
Python
スター
528
フォーク
977
平均マージ
2日 19時間
マージ済み PR(30日)
19

環境構築

  • Dockerfile・Docker Compose ファイルなし
  • プルリクエストのテンプレートあり
  • コントリビューションガイドなし

はじめの一歩

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

confluentinc/confluent-kafka-python のほかの issue

confluentinc/confluent-kafka-python の issue をすべて見る

似ている issue

Python の issue をもっと見る

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

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