With regard to backporting to 2.7:
In 2.7 also, PyNumber_Absolute() is called, and its return value is stored in
the variable n.
However, there is no _PyLong_NumBits(n), so there is no assertion failure.
If n isn't an integer:
- if !PyObject_IsTrue(n), then the seed is zero (e.g. if n is None, [], () or {})
- otherwise, PyNumber_And() and PyNumber_Rshift() are used in a loop on n, so
probably a TypeError would be raised.
So I think a backport is still desirable, but i am not sure about the test.
Maybe we should use @cpython_only, and make sure that no error is raised?
We can also make sure that random() returns a different value than when the
seed is zero.
What do you think? |