From aea1cde01c4e3f9c1e6d33557dffc2ff7ae6b1c1 Mon Sep 17 00:00:00 2001 From: "Steven G. Johnson" Date: Thu, 7 Jun 2018 15:12:58 +0200 Subject: [PATCH] silence 0.7 deprecations (#179) * silence 0.7 deprecations * bump compat to 0.68 to fix cfunction problem --- REQUIRE | 2 +- src/ZMQ.jl | 14 +++++++++----- test/runtests.jl | 2 +- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/REQUIRE b/REQUIRE index 3d7adc9..ac2a810 100644 --- a/REQUIRE +++ b/REQUIRE @@ -1,3 +1,3 @@ julia 0.6 -Compat 0.41.0 +Compat 0.68.0 BinaryProvider 0.3.0 diff --git a/src/ZMQ.jl b/src/ZMQ.jl index 8412c32..10adca1 100644 --- a/src/ZMQ.jl +++ b/src/ZMQ.jl @@ -23,8 +23,9 @@ include(depsjl_path) import Base: convert, get, length, size, stride, similar, getindex, setindex!, - fd, wait, notify, close, connect, - bind, send, recv + fd, wait, notify, close + +import Compat.Sockets: connect, bind, send, recv export #Types @@ -32,7 +33,10 @@ export #functions set, subscribe, unsubscribe, #Constants - IO_THREADS,MAX_SOCKETS,PAIR,PUB,SUB,REQ,REP,ROUTER,DEALER,PULL,PUSH,XPUB,XSUB,XREQ,XREP,UPSTREAM,DOWNSTREAM,MORE,POLLIN,POLLOUT,POLLERR,STREAMER,FORWARDER,QUEUE,SNDMORE + IO_THREADS,MAX_SOCKETS,PAIR,PUB,SUB,REQ,REP,ROUTER,DEALER,PULL,PUSH,XPUB,XSUB,XREQ,XREP,UPSTREAM,DOWNSTREAM,MORE,POLLIN,POLLOUT,POLLERR,STREAMER,FORWARDER,QUEUE,SNDMORE, + #Sockets + connect, bind, send, recv + const SNDMORE = true # A server will report most errors to the client over a Socket, but @@ -385,7 +389,7 @@ end isfreed(m::Message) = haskey(gc_protect, m.handle) # AbstractArray behaviors: -similar(a::Message, ::Type{T}, dims::Dims) where {T} = Array{T}(dims) # ? +similar(a::Message, ::Type{T}, dims::Dims) where {T} = Array{T}(undef, dims) # ? # TODO: change `Any` to `Ref{Message}` when 0.6 support is dropped. length(zmsg::Message) = Int(ccall((:zmq_msg_size, libzmq), Csize_t, (Any,), zmsg)) size(zmsg::Message) = (length(zmsg),) @@ -557,7 +561,7 @@ function __init__() if version < v"3" error("ZMQ version $version < 3 is not supported") end - gc_free_fn_c[] = cfunction(gc_free_fn, Cint, Tuple{Ptr{Cvoid}, Ptr{Cvoid}}) + gc_free_fn_c[] = @cfunction(gc_free_fn, Cint, (Ptr{Cvoid}, Ptr{Cvoid})) end end diff --git a/test/runtests.jl b/test/runtests.jl index 7cc2361..2db5a1e 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -38,7 +38,7 @@ Compat.@info("Testing with ZMQ version $(ZMQ.version)") # Note that we have to send this message to work around # https://github.com/JuliaInterop/ZMQ.jl/issues/166 @test similar(msg, UInt8, 12) isa Vector{UInt8} - @test copy(msg) == Vector{UInt8}("test request") + @test copy(msg) == codeunits("test request") ZMQ.send(s2, msg) @test unsafe_string(ZMQ.recv(s1)) == "test request" ZMQ.send(s1, Message("test response"))