FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

(馃悶) Crash with `TypeGuard` on `__call__` 路 Issue #16187 路 python/mypy 路 GitHub

Repository navigation

(馃悶) Crash with TypeGuard on __call__聽#16187

Closed

Description

from typing import TypeGuard
class A:
    def __call__(self, a) -> TypeGuard[int]:
        return True

a: A
assert a(a=1)
> mypy test.py --tb
test.py:7: error: INTERNAL ERROR -- Please try using mypy master on GitHub:
https://mypy.readthedocs.io/en/stable/common_issues.html#using-a-development-mypy-build
Please report a bug at https://github.com/python/mypy/issues
version: 1.5.1
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "mypy\checker.py", line 584, in accept
    # least one type that we don't know.
  File "mypy\nodes.py", line 1435, in accept
  File "mypy\checker.py", line 4409, in visit_assert_stmt
    return  # The partial type is None.
  File "mypy\checker.py", line 5455, in find_isinstance_check
    return [typ], []
  File "mypy\checker.py", line 5501, in find_isinstance_check_helper
    """
AssertionError:
test.py:7: : note: use --pdb to drop into pdb
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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions


      Back | FazBrowse Home | New Git URL