[issue42008] Internal Random class calling seed() with incorrect argument

2020-12-21 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

Thanks for the PR :-)

--
assignee:  -> rhettinger
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
versions:  -Python 3.8, Python 3.9

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42008] Internal Random class calling seed() with incorrect argument

2020-12-21 Thread Raymond Hettinger


Raymond Hettinger  added the comment:


New changeset b8fde8b5418b75d2935d0ff93b20d45d5350f206 by AMIR in branch 
'master':
bpo-42008: Fix internal _random.Random() seeding for the one argument case 
(GH-22668)
https://github.com/python/cpython/commit/b8fde8b5418b75d2935d0ff93b20d45d5350f206


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42008] Internal Random class calling seed() with incorrect argument

2020-10-12 Thread Amir Mohamadi


Change by Amir Mohamadi :


--
keywords: +patch
pull_requests: +21641
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/22668

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42008] Internal Random class calling seed() with incorrect argument

2020-10-12 Thread Amir Mohamadi


Amir Mohamadi  added the comment:

Can I open a PR for it?

--
nosy: +Amir

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42008] Internal Random class calling seed() with incorrect argument

2020-10-11 Thread Raymond Hettinger


New submission from Raymond Hettinger :

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

--
components: Extension Modules
keywords: easy (C)
messages: 378457
nosy: rhettinger
priority: normal
severity: normal
status: open
title: Internal Random class calling seed() with incorrect argument
type: behavior
versions: Python 3.10, Python 3.8, Python 3.9

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com