-
-
Notifications
You must be signed in to change notification settings - Fork 491
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
Broken doctest in src/sage/categories/fields.py #19244
Comments
Author: Simon King |
comment:2
I have seen that repeatedly. I think at some point I suggested to test that the difference is not zero but is at most zero. Now I suggest a different solution. We have seen the following phenomenon while we introduced Sage's weak coercion dictionaries. It is possible that It could be that we see this phenomenon here in real life. I.e., it could be that the two Thus, depending on whether or not a third collection happens, we see a failure or not. If my explanation is correct, then disabling the garbage collection till we really want it to happen should fix the test permanently. New commits:
|
Commit: |
comment:3
The following approach might be even more stable. What do we want to test? We want to test that the NEWLY created fields can be garbage collected. What happens if the test fails? There is an additional garbage collection of a PREVIOUSLY created field. Hence, we must temporarily prevent all PREVIOUSLY created but uncollected objects from garbage collection. This could be done by storing the output of gc.get_object() in a variable. It creates strong references to all previously created uncollected objects and will thus make the test stable. What solution do you prefer? I prefer the second solution, since I am not sure whether the theory behind my previous solution is correct. |
comment:4
Replying to @simon-king-jena:
I agree. |
Branch pushed to git repo; I updated commit sha1. New commits:
|
comment:6
Make your choice :-) |
comment:7
What's the point of this? + sage: len([X for X in gc.get_objects() if isinstance(X, sage.rings.finite_rings.integer_mod_ring.IntegerModRing_generic)]) > n
+ True |
comment:8
Replying to @jdemeyer:
At time t, we determine the number n of fields in cache. At time t+2 we test that the number of fields in cache is again n. With the above line, I want to demonstrate that at time t+1, we really have more rings in cache than at time t. Otherwise, we actually haven't shown that a garbage collection has happened between time t+1 and time t+2. And that's the aim of the whole test: We have to show that at some point a ring exists and later it has vanished. The line shows that the ring exists. |
comment:9
Could you add some text in the doctest to explain what you just explained here? |
Branch pushed to git repo; I updated commit sha1. New commits:
|
Reviewer: Jeroen Demeyer |
comment:12
Since the old broken doctest is hard to reproduce, I can't say for sure if this fixes it. But at least I believe your analysis. |
Changed branch from u/SimonKing/broken_doctest_in_src_sage_categories_fields_py to |
The following doctest from #14058 breaks sometimes. I have seen it happen twice, but it's hard to reproduce:
CC: @robertwb @nbruin @simon-king-jena @jpflori @seblabbe @videlec
Component: memleak
Keywords: random_fail
Author: Simon King
Branch/Commit:
c289fb0
Reviewer: Jeroen Demeyer
Issue created by migration from https://trac.sagemath.org/ticket/19244
The text was updated successfully, but these errors were encountered: