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
2-argument deserialize
should be internal
#14090
Labels
Comments
Yes, in hindsight it's clear to me that the 2-argument |
Well we no longer create abstract types... we just segfault:
|
StefanKarpinski
added
the
bug
Indicates an unexpected problem or unintended behavior
label
Aug 17, 2021
This throws a reasonable error in 1.9.0 julia> using Serialization
julia> s = Serializer(IOBuffer())
Serializer{IOBuffer}(IOBuffer(data=UInt8[...], readable=true, writable=true, seekable=true, append=false, size=0, maxsize=Inf, ptr=1, mark=-1), 0, IdDict{Any, Any}(), Int64[], Dict{UInt64, Any}(), 20)
julia> serialize(s, "hello")
julia> seekstart(s.io)
IOBuffer(data=UInt8[...], readable=true, writable=true, seekable=true, append=false, size=7, maxsize=Inf, ptr=1, mark=-1)
julia> v = deserialize(s, AbstractString);
ERROR: TypeError: in new, expected DataType, got Type{AbstractString}
Stacktrace:
[1] deserialize(s::Serializer{IOBuffer}, t::DataType)
@ Serialization ~/.julia/juliaup/julia-1.9.0+0.aarch64.apple.darwin14/share/julia/stdlib/v1.9/Serialization/src/Serialization.jl:1492
[2] top-level scope
@ REPL[5]:1 |
#14090 (comment) seems like it stands. |
LilithHafner
added
deprecation
This change introduces or involves a deprecation
and removed
bug
Indicates an unexpected problem or unintended behavior
labels
Jun 5, 2023
LilithHafner
changed the title
2-argument Jun 5, 2023
deserialize
can create objects with abstract typesdeserialize
should be internal
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
When implementing serialization for a type I defined, I accidentally called
deserialize
with two arguments, passing the expected type as second argument. Since the respective field was declared asAbstractString
, this is the type I passed. As a result, I received a very strange error message:It seems as if
deserialize
created an object of typeAbstractString
that (of course) later cannot be handled.This reproduces the error:
The text was updated successfully, but these errors were encountered: