Closed swadey closed 10 years ago
Seems to be related to writing of SubString
How so? We've seen some other SubString
weirdness recently so if you have an example/test case it might be helpful.
Well, it seems quite clear that one of the write
methods is not returning the number of bytes written as it should.
OK, here's a simpler example:
julia> a = ["1", "2", "3"]
3-element Array{ASCIIString,1}:
"1"
"2"
"3"
julia> open("test.out", "w") do f write(f, a) end
3
julia> a = split(strip("1 2 3"), r"\s+")
3-element Array{SubString{ASCIIString},1}:
"1"
"2"
"3"
julia> open("test.out", "w") do f write(f, a) end
ERROR: no method +(Int64, Nothing)
in write at io.jl:61
in write at io.jl:391
in anonymous at none:1
in open at io.jl:373
julia> open("test.out", "w") do f x = write(f, a[1]::SubString{ASCIIString}); println(x) end
nothing
I'm guessing that this is an invariance problem, i.e. SubString{ASCIIString}
isn't the same as SubString{ByteString}
?
Good call, @loladiro: https://github.com/JuliaLang/julia/blob/master/base/string.jl#L68
When writing out to a file, I get:
Here's a minimized code example: