rand.c, pgen.c: Invalidate random generators from pgen events.
authorMark Wooding <mdw@distorted.org.uk>
Fri, 9 Nov 2018 17:23:00 +0000 (17:23 +0000)
committerMark Wooding <mdw@distorted.org.uk>
Fri, 22 Nov 2019 22:18:11 +0000 (22:18 +0000)
commitf979190bf2b10b5bb3c26ca4005dcccbcb1455b8
tree79b1ebc7cc6aaeb79a84abd75a74aea7f3921f4d
parentba03351306bcd298ca10572f40bef9ab6c1b9050
rand.c, pgen.c: Invalidate random generators from pgen events.

I've not actually seen a crash from a Python program which keeps hold of
the random generator from a prime-generation event and tries to use it
after the operation has finished, but it was certainly possible.

Arrange for the event object to retain the random generator object (so
it always hands out the same one when requested), and invalidates it
when the event is itself invalidated.

This also involves messing with the `grand' code to cope with the idea
of invalidated random generators.

(cherry picked from commit d65d80d7c096e6afc500270ee29909f64869e5dc)
pgen.c
rand.c