Skip to content

fix: align KafkaError stub keyword with runtime#2278

Open
wgu9 (wgu9) wants to merge 1 commit into
confluentinc:masterfrom
wgu9:wgu9/fix-kafkaerror-stub-keyword
Open

fix: align KafkaError stub keyword with runtime#2278
wgu9 (wgu9) wants to merge 1 commit into
confluentinc:masterfrom
wgu9:wgu9/fix-kafkaerror-stub-keyword

Conversation

@wgu9

Copy link
Copy Markdown

Fixes #2243.

Changes

  • Rename the first KafkaError stub initializer parameter from code to error, matching the C extension keyword accepted at runtime.
  • Add a regression test covering the runtime keyword contract: error= is accepted and code= raises TypeError.

Validation

  • MYPYPATH=src uvx --from mypy==1.18.2 mypy --python-version 3.11 -c $'from confluent_kafka import KafkaError\\nKafkaError(error=1)'\n- MYPYPATH=src uvx --from mypy==1.18.2 mypy --python-version 3.11 -c $'from confluent_kafka import KafkaError\\nKafkaError(code=1)' confirms code= is rejected\n- python3 -m py_compile tests/test_kafka_error.py\n- uvx --from black black --check --diff tests/test_kafka_error.py\n- git diff --check\n\nNote: I could not run pytest tests/test_kafka_error.py locally because this fresh checkout does not have the compiled confluent_kafka extension or pytest installed. The added pytest is intended for CI, where the package is built before test execution.

@wgu9 wgu9 (wgu9) requested review from a team and Matthew Seal (MSeal) as code owners June 14, 2026 15:05
@confluent-cla-assistant

confluent-cla-assistant Bot commented Jun 14, 2026

Copy link
Copy Markdown

🎉 All Contributor License Agreements have been signed. Ready to merge.
✅ wgu9
Please push an empty commit if you would like to re-run the checks to verify CLA status for all contributors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

1 participant