Skip to content

KafkaConsumer.subscribe(topics='t', pattern='^t') should throw ValueError not AssertionError #891

Open
@jeffwidman

Description

@jeffwidman

For KafkaConsumer.subscribe() either topics or pattern must be specified but not both. While experimenting, I noticed that when I break this contract, I get an AssertionError.

Since this is caused by bad input, and not bad code, this should throw ValueError not AssertionError.

Assertions will get stripped out if python is run with the optimized flag, removing the safety net of this check. While rare in dev, some places do run python this way in production.

Happy to put together a PR if you want, but wanted to doublecheck you're on board with this change.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions