You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We now have some effective strategies for dealing with non-deterministic behavior, by adding contracts to existing functions.
Let's apply them to the standard library. Some high-priority ones off the top of my head:
time.time
time.uniform
random.choice
random.randint / randrange / uniform / random / randbits
functools.lru_cache / cache
sys.stdin
uuid.uuid*
The text was updated successfully, but these errors were encountered:
The remaining ones may require even more capabilities. I'm not immediately prioritizing them.
For instance, I'd like to simply disable lru_cache and friends, but it seems like we'd need to intercept it at import time rather than at run time. For stdin, I'd like to intercept only the read() bound to stdin, not to any TextIOWrapper.
I figured out a workaround for disabling the caching behaviors of lru_cache and cache: we dynamically detect the wrapper functions at runtime and skip the caching bits. Implemented in 2ab5105
Now, you won't get non-deterministic errors when analyzing behavior that involves these caches!
We now have some effective strategies for dealing with non-deterministic behavior, by
adding contracts to existing functions.
Let's apply them to the standard library. Some high-priority ones off the top of my head:
The text was updated successfully, but these errors were encountered: