diff --git a/src/io.jl b/src/io.jl index c3ce35d..2b6d515 100644 --- a/src/io.jl +++ b/src/io.jl @@ -235,12 +235,21 @@ function _evenlydistribute!(t, wrkrs) end end +_ismutabletype = if VERSION < v"1.7" + function ismutabletype(@nospecialize(t::Type)) + t = unwrap_unionall(t) + return isa(t, DataType) && t.name.flags & 0x2 == 0x2 + end +else + Base.ismutabletype +end + deserialize(io::AbstractSerializer, DT::Type{DNDSparse{K,V}}) where {K,V} = _deser(io, DT) deserialize(io::AbstractSerializer, DT::Type{DIndexedTable{T,K}}) where {T,K} = _deser(io, DT) function _deser(io::AbstractSerializer, t) nf = fieldcount(t) x = ccall(:jl_new_struct_uninit, Any, (Any,), t) - t.mutable && Serialization.deserialize_cycle(io, x) + _ismutabletype(t) && Serialization.deserialize_cycle(io, x) for i in 1:nf tag = Int32(read(io.io, UInt8)::UInt8) if tag != Serialization.UNDEFREF_TAG