Skip to content
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

0.7compat #90

Merged
merged 3 commits into from
Aug 10, 2018
Merged

0.7compat #90

merged 3 commits into from
Aug 10, 2018

Conversation

gdkrmr
Copy link
Contributor

@gdkrmr gdkrmr commented Aug 4, 2018

I gave it a shot but cannot find out why I get the following error:

https://travis-ci.org/gdkrmr/JLD2.jl/jobs/412170446#L501

ERROR: LoadError: LoadError: UndefVarError: arr_undef not defined

This gets a warning in 0.7:

┌ Warning: Deprecated syntax `implicit assignment to global variable `arr_undef``.
│ Use `global arr_undef` instead.
└ @ none:0

I removed all the deprecation warning I could locate. I am not sure about about the right usage of unsafe_wrap instead of Vector{UInt8}, you may want to check those.

I also don't know how to deal with this one:

https://travis-ci.org/gdkrmr/JLD2.jl/jobs/412170446#L495

┌ Warning: Deprecated syntax `"begin" inside indexing expression` at /home/travis/build/gdkrmr/JLD2.jl/src/data.jl:900.
└ @ ~/build/gdkrmr/JLD2.jl/src/data.jl:900

@@ -761,7 +761,7 @@ function h5convert!(out::Pointers, fls::FixedLengthString, f::JLDFile, x, ::JLDW
(unsafe_copyto!(convert(Ptr{UInt8}, out), pointer(x), fls.length); nothing)
end
h5convert!(out::Pointers, ::Type{Vlen{String}}, f::JLDFile, x, wsession::JLDWriteSession) =
store_vlen!(out, UInt8, f, Vector{UInt8}(x), wsession)
store_vlen!(out, UInt8, f, unsafe_wrap(Array{UInt8}, pointer(x), ncodeunits(x)), wsession)
Copy link
Contributor

@JeffBezanson JeffBezanson Aug 7, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is incorrect, as it can drop references to x. If x is a String, we want

unsafe_wrap(Vector{UInt8}, x)

@JeffBezanson
Copy link
Contributor

Also needs:

--- a/src/data.jl
+++ b/src/data.jl
@@ -894,7 +894,7 @@ function jlconvert(::ReadRepresentation{T,DataTypeODR()}, f:
     if hasparams
         paramrefs = jlconvert(ReadRepresentation{RelOffset,Vlen{RelOffset}}(), 
                               ptr+odr_sizeof(Vlen{UInt8}), NULL_REFERENCE)
-        params = Any[begin
+        params = Any[let
             # If the reference is to a committed datatype, read the datatype
             nulldt = CommittedDatatype(UNDEFINED_ADDRESS, 0)
             cdt = get(f.datatype_locations, ref, nulldt)

@JeffBezanson
Copy link
Contributor

Also

--- a/test/rw.jl
+++ b/test/rw.jl
@@ -517,7 +517,7 @@ for ioty in [JLD2.MmapIO, IOStream], compress in [false, tru
     @check fidr typevar_lb_ub
 
     # Special cases for reading undefs
-    arr_undef = read(fidr, "arr_undef")
+    global arr_undef = read(fidr, "arr_undef")
     if !isa(arr_undef, Array{Any, 1}) || length(arr_undef) != 1 || isassigned(a
         error("For arr_undef, read value does not agree with written value")
     end

Hopefully that will fix the remaining issues.

@JeffBezanson
Copy link
Contributor

I put those changes in #91.

@gdkrmr
Copy link
Contributor Author

gdkrmr commented Aug 8, 2018

so instead of [begin ... end for i in I] you can always do [let ... end for i in I]? When I was searching the documentation I was not able to find this. I added a PR for the documentation: JuliaLang/julia#28519

Thanks for completing this!

@staticfloat staticfloat merged commit 98eeeac into JuliaIO:master Aug 10, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants