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>
Sat, 10 Nov 2018 01:30:58 +0000 (01:30 +0000)
commitd65d80d7c096e6afc500270ee29909f64869e5dc
treeebb2c7bb839da2c8ed0384a0636a8150622ed350
parent4fe9818b8d566ad45fc1a4d74857024c1c409406
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.
pgen.c
rand.c