pschanely / CrossHair

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

Accept `map()` object - or any iterable - in `int.from_bytes()` #291

Closed Zac-HD closed 3 months ago

Zac-HD commented 3 months ago

found via Hypothesis CI for https://github.com/HypothesisWorks/hypothesis/pull/4034, it looks like int.from_bytes should accept any iterable:

  File ".../lib/python3.10/ipaddress.py", line 1195, in _ip_int_from_string
    return int.from_bytes(map(cls._parse_octet, octets), 'big')
  File ".../crosshair/libimpl/builtinslib.py", line 4627, in _int_from_bytes
    realize(len(b))
  File ".../crosshair/libimpl/builtinslib.py", line 4509, in _len
    raise TypeError(f"object of type '{name_of_type(type(ls))}' has no len()")
TypeError: object of type 'map' has no len()
pschanely commented 3 months ago

Yes! On it.

pschanely commented 3 months ago

Fixed in v0.0.66!