-
Notifications
You must be signed in to change notification settings - Fork 22
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
change iteration over GAP objects #1057
Conversation
ThomasBreuer
commented
Oct 18, 2024
- omit holes when iterating over GAP lists (resolves Skip holes when iterating over GAP lists? #970)
- extend documentation accordingly
- fix a GAPDoc error in the JuliaInterface manual
- omit holes when iterating over GAP lists - extend documentation - fix a GAPDoc error in the JuliaInterface manual
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #1057 +/- ##
==========================================
- Coverage 74.98% 74.92% -0.07%
==========================================
Files 55 55
Lines 4549 4554 +5
==========================================
+ Hits 3411 3412 +1
- Misses 1138 1142 +4
|
The effect of this missing declaration was strange: I did not get error messages when trying `include("test/runtests.jl")`, but the CI tests showed the GAP warning together with an (intended) error message, which caused a different output there and hence a test failure.
@@ -496,7 +495,12 @@ end | |||
|
|||
function Base.iterate(obj::GapObj, (i, len)::Tuple{Int,Int}) | |||
i > len && return nothing | |||
ElmList(obj, i), (i+1, len) | |||
res = ElmList(obj, i) | |||
while res === nothing # dangerous if `len` is *larger* than the length |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is it possible for a GAP iterator to have holes at the end? If yes, this may be an infinite loop.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The length is the position of the last bound element. Thus it is safe to call the function with the correct len
.
However, if one deliberately enters a too big len
and i
is not larger than len
but already larger than the length then one enters the while
loop, and this loop will be infinite.