Skip to content

Commit 5c0d5f3

Browse files
authored
check overrun first
1 parent aba96ba commit 5c0d5f3

File tree

1 file changed

+5
-6
lines changed
  • hypothesis-python/src/hypothesis/internal/conjecture

1 file changed

+5
-6
lines changed

hypothesis-python/src/hypothesis/internal/conjecture/engine.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -434,17 +434,16 @@ def kill_branch(self) -> NoReturn:
434434
else:
435435
trial_data.freeze()
436436
key = self._cache_key_ir(data=trial_data)
437-
if trial_data.status > Status.OVERRUN:
438-
try:
439-
return self.__data_cache_ir[key]
440-
except KeyError:
441-
pass
442-
else:
437+
if trial_data.status is Status.OVERRUN:
443438
# if we simulated to an overrun, then we our result is certainly
444439
# an overrun; no need to consult the cache. (and we store this result
445440
# for simulation-less lookup later).
446441
self.__data_cache_ir[key] = Overrun
447442
return Overrun
443+
try:
444+
return self.__data_cache_ir[key]
445+
except KeyError:
446+
pass
448447

449448
data = self.new_conjecture_data_ir(nodes, max_length=max_length)
450449
# note that calling test_function caches `data` for us, for both an ir

0 commit comments

Comments
 (0)