-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
do not catch everything in isassigned #18075
Conversation
Thanks, this was confusing when printing a broken custom array type gave lots of |
catch | ||
false | ||
catch e | ||
if isa(e, BoundsError) || isa(e, UndefRefError) |
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.
why BoundsError
?
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.
ok, i didn't realize that worked:
julia> isassigned([], 2)
false
lgtm
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.
But yeah, why not just use checkbounds
for the bounds check part?
However, there doesn't seem to be anyway of checking if the field is undef without just trying to access it since that error is thrown from the runtime?
Because thats what the docs say. |
If you think this should be backported, do speak up. |
Not sure. It is a behaviour change so probably shouldn't? |
On the other hand it could be considered a bug fix since it now actually checks what the docs say it should check... |
If
getindex
on anAbstractArray
errors withThrowMeOrEveryoneWillPerishOhMyGodTheyAreComingException
we should probably throw it instead of just returningfalse
inisassigned
.