Skip to content

Commit

Permalink
Merge branch 'ir-shrinker-preparation' of github.com:tybug/hypothesis…
Browse files Browse the repository at this point in the history
… into ir-shrinker-preparation
  • Loading branch information
tybug committed Mar 4, 2024
2 parents b0d022f + f89db6f commit a899b41
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions hypothesis-python/src/hypothesis/internal/conjecture/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -1746,17 +1746,18 @@ def draw_boolean(
return value

def _pooled_kwargs(self, ir_type, kwargs):
"""Memoize common dictionary objects to reduce memory pressure."""
key = []
for k, v in kwargs.items():
if ir_type == "float" and k in ["min_value", "max_value"]:
# handle -0.0 vs 0.0, etc.
v = float_to_int(v)
if ir_type == "integer" and k == "weights":
elif ir_type == "integer" and k == "weights":
# make hashable
v = v if v is None else tuple(v)
key.append((k, v))

key = tuple(key)
key = (ir_type, *sorted(key))

try:
return POOLED_KWARGS_CACHE[key]
Expand Down

0 comments on commit a899b41

Please sign in to comment.