Closed jakkdl closed 1 year ago
Actually, since I landed on ast.literal_eval
being pretty much the same as matching against an integer + handling unary operation, I rewrote iter_guaranteed_once_cst
not to need cst_literal_eval
. It probably wouldn't be very hard at all to evaluate unary/binary ops either, and range(10*23)
isn't that uncommon. Can open an issue for it
And with the only remaining user of it being visit_While_test ... and I don't think we care about handling while [1, 2]: ...
(and can get it for free if libcst implements evaluated_value for containers), I rewrote that one as well .. and completely removed cst_literal_eval
.
Reading through https://docs.python.org/3/library/stdtypes.html#range it mentioned len
not working with sys.maxsize
- so code now handles very long loops now as well :smiley:
# length > sys.maxsize
for i in range(27670116110564327421):
await foo()
yield
Reading through https://docs.python.org/3/library/stdtypes.html#range it mentioned
len
not working withsys.maxsize
Heh, that note is my fault 😂 (Hypothesis is a great way to find edge cases...)
ooh, nice!
Fix comments from #143 and general minor code cleanup