-
-
Notifications
You must be signed in to change notification settings - Fork 452
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
py3: problems with tests that use random_element #24508
Comments
comment:1
Also worth pointing out: There were good reasons to change the implementation, AFAICT, as some bugs were addressed. So using the Python 3 implementation might be better. However, that would mean fixing hundreds, possibly thousands of tests, so maybe it's not such a good idea (or maybe the Python 2 implementation should be used only in testing or something). |
comment:2
there is also an issue about
that I have already point out elsewhere |
comment:3
What's really the problem there? I think the |
comment:4
well, nobody tried to drop it (not me at least) |
comment:5
It's gone in my branch. I don't think it has anything to do with this problem. |
comment:6
Here's a possible workaround for this issue. This is far from ideal in that it wholesale copy/pastes the Python 2 implementation of This is also not great since we should be testing against the real New commits:
|
Branch: u/embray/python3/ticket-24508 |
Dependencies: #24787 |
Author: Erik Bray |
Commit: |
comment:7
I confirmed that this fixed most tests that were known to be failing due to this issue (of which there were quite a lot). |
comment:8
|
comment:9
Replying to @jdemeyer:
I considered that--it seemed unlikely considering that through Python 2.7.14 this has never been an issue, and most non-essential fixes are not being backported to Python 2. Then again, Python 2 will still be receiving security-related fixes for a while, and the
A minor point but true. |
Changed dependencies from #24787 to none |
Reviewer: Jeroen Demeyer |
comment:16
Patchbot suggests that "plugins failed" but it's completely non-obvious from the output what plugins failed... |
Changed branch from u/embray/python3/ticket-24508 to |
Lots and lots of tests fail on Python 3 due to the use of
random_element
s in tests.The problem, I've found, is not to do with seeding the RNG. Python's
random
produces the same sequence with the same seed on Python 2 and 3. However, there is a slight difference in the implementation ofrandom.randint
, such that it does produce different values, annoyingly.I'm not sure how we want to deal with this. In Sage there's a
sage.misc.prandom
that for some reason provides wrappers around functions from Python'srandom
module. Perhaps one thing we could do is ensure thatsage.misc.prandom
is always used, and modify its wrapper torandint
(actuallyrandrange
, whichrandint
is implemented on top of), to provide consistent results.Component: python3
Author: Erik Bray
Branch/Commit:
4ac044a
Reviewer: Jeroen Demeyer
Issue created by migration from https://trac.sagemath.org/ticket/24508
The text was updated successfully, but these errors were encountered: