Skip to content

Commit

Permalink
reorg
Browse files Browse the repository at this point in the history
  • Loading branch information
rsokl committed Nov 18, 2022
1 parent 9e2f3f7 commit 0a43b9b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions hypothesis-python/src/hypothesis/internal/entropy.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,9 @@ def my_hook():
if not (hasattr(r, "seed") and hasattr(r, "getstate") and hasattr(r, "setstate")):
raise InvalidArgument(f"r={r!r} does not have all the required methods")

if r in RANDOMS_TO_MANAGE.values():
return

if not PYPY:
# PYPY does not have `sys.getrefcount`
gc.collect()
Expand All @@ -143,8 +146,7 @@ def my_hook():
"See the docs for `register_random` for more details."
)

if r not in RANDOMS_TO_MANAGE.values():
RANDOMS_TO_MANAGE[next(_RKEY)] = r
RANDOMS_TO_MANAGE[next(_RKEY)] = r


def get_seeder_and_restorer(
Expand Down

0 comments on commit 0a43b9b

Please sign in to comment.