-
-
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
objects of type BigFloat cannot be finalized because they are not mutable
#55965
Comments
I am not quite certain what you'd expect here. The Number types are all documented as being immutable, and now #55906 aligns the reflection query to be consistent with that |
The test that got changed in https://github.com/JuliaLang/julia/pull/55906/files#diff-d550de483dd02fa6687b5042154db6ac1133df4890fb1cf92220e51ec83ebfe2 also expected BigFloat to be mutable. The change (changing the example to BigInt) will possibly break as well, once BigInt is changed to be actually mutable as well. Furthermore, the test was originally about #26939, as issue explicitly about BigFloat, so I don't know if this test change in this way is actually sensible here. What I consider the breaking change here is that the following piece of code used to work but no longer does. It doesn't use any internals. (Note that the WeakKeyDict docstring doesn't restrict the allowed key types at all) julia> d26939 = WeakKeyDict()
WeakKeyDict{Any, Any}()
julia> d26939[big"1.0" + 1.1] = 1
ERROR: objects of type BigFloat cannot be finalized because they are not mutable |
I think that's just how struct S end
d = WeakKeyDict()
d[S()] = 1 So the key must be a |
I think everyone agrees on that. The discussion is about if making a mutable struct immutable should be considered "breaking" since code that used to work (putting the object into a weak key dict) now errors. |
Unfortunately that test hadn't worked correctly since 2644f79 in 2018, so this was a necessary fix to make the test itself test what it was supposed to test (that finalizer ordering is correct with respect to WeakRefs) |
This error occurs in our nightly CI at https://github.com/Nemocas/AbstractAlgebra.jl since #55906 is merged.
Apparently, this PR changed
ismutable(BigFloat(2))
fromtrue
tofalse
.I would have expected for a change like that a "minor change" or even a "breaking" label, and a pkgeval before merge.
The text was updated successfully, but these errors were encountered: