cunla / fakeredis-py

Implementation of Redis in python without having a Redis server running. Fully compatible with using redis-py.
https://fakeredis.moransoftware.ca/
BSD 3-Clause "New" or "Revised" License
298 stars 48 forks source link

`random` entropy globally reduced for all importers #315

Closed Redoubts closed 3 months ago

Redoubts commented 3 months ago

Describe the bug https://github.com/cunla/fakeredis-py/blob/5240b69b13160584b6f9ed748dbc8843427b3671/fakeredis/stack/_topk_mixin.py#L13

This line has call which globally sets the seed for all users of random, and this happens at import time for users of fakeredis. Is this needed? If so, can this module create its own generator for internal use? https://docs.python.org/3/library/random.html#random.Random

Expected behavior Side-effect free imports

Upvote & Fund

Fund with Polar

cunla commented 3 months ago

Makes sense. I'll publish an update.