Open Zac-HD opened 1 month ago
Oh wow. OOC, from a product perspective, what does hypothesis do about this? st.integers
is by default unbounded, and stringification is common (logging etc). But most users probably don't care to think about this kind of failure case. I assume it takes hypothesis so long to attempt such an integer that it doesn't matter?
Also, does hypothesis do something to avoid hitting this limit internally? Someone might want to make a test to check how this limitation affects their code, but hypothesis still needs to display the counterexample.
Currently we don't do anything particular to handle this case; unbounded integers only go up to 256-bits by default and that regression test would fail if we happened to convert to a string internally.
Having been reminded that this new error exists, I'm planning to upgrade the pretty-printer to display too-large integers in hexadecimal instead. https://github.com/HypothesisWorks/hypothesis/issues/4058
This is a horrible regression test for a case where Hypothesis wasn't handling large integers (https://github.com/HypothesisWorks/hypothesis/issues/3874), but I presume you'll want to do something which isn't crashing. And it looks like we have two meaningfully distinct issues in the same traceback! Relevant stdlib docs here; converting really big ints to strings is expensive if the base is not a power of two.
(via https://github.com/HypothesisWorks/hypothesis/pull/4034)