Skip to content

Commit 040f436

Browse files
committed
truncate novel prefixes
1 parent 3c15b34 commit 040f436

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

hypothesis-python/RELEASE.rst

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
RELEASE_TYPE: patch
2+
3+
This patch removes an assertion which was in fact possible in rare circumstances involving a small number of very large draws.

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

+4-1
Original file line numberDiff line numberDiff line change
@@ -999,7 +999,10 @@ def generate_new_examples(self) -> None:
999999

10001000
self._current_phase = "generate"
10011001
prefix = self.generate_novel_prefix()
1002-
assert len(prefix) <= BUFFER_SIZE
1002+
# it is possible, if unlikely, to generate a > BUFFER_SIZE novel prefix,
1003+
# as nodes in the novel tree may be variable sized due to eg integer
1004+
# probe retries.
1005+
prefix = prefix[:BUFFER_SIZE]
10031006
if (
10041007
self.valid_examples <= small_example_cap
10051008
and self.call_count <= 5 * small_example_cap

0 commit comments

Comments
 (0)