pschanely / CrossHair

An analysis tool for Python that blurs the line between testing and type systems.
Other
996 stars 47 forks source link

`typing.get_type_hints()` raises `ValueError` when used inside Crosshair #275

Closed Zac-HD closed 1 month ago

Zac-HD commented 2 months ago
import typing

class Foo:
    def __init__(self, values: list) -> None:
        self._values = values

def fn(_: bool):
    """ post: True """
    return typing.get_type_hints(Foo)

the useful part of the traceback I got is

  File ".../lib/python3.10/typing.py", line 1970, in get_type_hints
    base_locals = dict(vars(base)) if localns is None else localns
  File ".../crosshair/libimpl/builtinslib.py", line 4280, in _dict
    raise ValueError
ValueError
pschanely commented 1 month ago

Fixed in v0.0.64