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?
The name of the 1st parameter for
KafkaError's initialiser insrc/confluent_kafka/cimpl.pyiis nowcode(ref here), however this does not match the underlying code itself.For example, if we try to create an instance of
KafkaErroraccording to the signature:Then
mypyis OK with thisBut we get a
TypeErrorwhen it runsI'm happy to submit a PR to fix this but which way do we want to go here? Change the signature in the
.pyifile so it matches what the underlying C code expects? Or change the underlying C code to match up with the signature?