Author rhettinger
Recipients rhettinger
Date 2020-10-11.21:52:41
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1602453161.68.0.0739681342621.issue42008@roundup.psfhosted.org>
In-reply-to
Content
The C code in random_new() incorrectly calls random_seed() with an args tuple. Instead, it should use first element of the args tuple.

This matters because we've deprecated using PyObject_Hash() in random_seed().  Once that is removed, _random.Random(someseed) won't work at all (there's a test for it).

# Public API is correct
>>> from random import Random
>>> r = Random()
>>> r.seed(8675309)
>>> r.random()
0.40224696110279223
>>> r = Random(8675309)
>>> r.random()
0.40224696110279223

# Private API is incorrect for Random(someseed)
>>> from _random import Random
>>> r = Random()
>>> r.seed(8675309)
>>> r.random()
0.40224696110279223
>>> r = Random(8675309)              
>>> r.random()
0.21095576307886765                  <=== This is wrong
History
Date User Action Args
2020-10-11 21:52:41rhettingersetrecipients: + rhettinger
2020-10-11 21:52:41rhettingersetmessageid: <1602453161.68.0.0739681342621.issue42008@roundup.psfhosted.org>
2020-10-11 21:52:41rhettingerlinkissue42008 messages
2020-10-11 21:52:41rhettingercreate