Thanks to visit codestin.com
Credit goes to github.com

Skip to content

i64 could always be true #21898

Description

@Dreamsorcerer
from mypy_extensions import i64

i: i64 = 0
if i: pass

Type checked with mypy, this reports:

error: has tpe "i64" which does not implement __bool__ or __len__ so it could always be true in boolean context

In reality, truthy tests work fine in both compiled and non-compiled code, so seems like there's something missing here for mypy to understand the type correctly.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugmypy got something wrongtopic-reachabilityDetecting unreachable code

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions