Skip to content

Commit

Permalink
Merge pull request python-trio#840 from Zac-HD/randomness
Browse files Browse the repository at this point in the history
Use module-level Random to shuffle tasks
  • Loading branch information
njsmith authored Jan 6, 2019
2 parents b208624 + 73d397e commit e5927e9
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions trio/_core/_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,6 @@ class Runner:

runq = attr.ib(default=attr.Factory(deque))
tasks = attr.ib(default=attr.Factory(set))
r = attr.ib(default=attr.Factory(random.Random))

# {(deadline, id(CancelScope)): CancelScope}
# only contains scopes with non-infinite deadlines that are currently
Expand Down Expand Up @@ -1433,7 +1432,7 @@ def run_impl(runner, async_fn, args):
# ordering of task._notify_queues.)
batch = list(runner.runq)
runner.runq.clear()
runner.r.shuffle(batch)
_r.shuffle(batch)
while batch:
task = batch.pop()
GLOBAL_RUN_CONTEXT.task = task
Expand Down

0 comments on commit e5927e9

Please sign in to comment.