Skip to content

Counting flags result in ZeroDivisionError #496

@seowalex

Description

@seowalex

Previously, the ability to add counting flags was requested in #249 and implemented in #251. In both the issue and PR, tuple[bool, ...] is used as the annotation type. However, this does not actually work, giving the following error:

ZeroDivisionError: integer modulo by zero

However, using list[bool] works (and is in fact what is tested, which is presumably why it wasn't caught).

It looks like this is due to _convert_tuple deciding that tuple[bool, ...] both has no inner tokens and also needs to consume all tokens, leading to a zero division error in:

remainder = len(tokens) % inner_token_count

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions