Skip to content

Commit

Permalink
Fix 0.6 depwarn about inner constructors (#358)
Browse files Browse the repository at this point in the history
  • Loading branch information
yuyichao authored and stevengj committed Feb 11, 2017
1 parent 945737a commit 58d30ed
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions src/conversions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -202,11 +202,11 @@ Alternatively, `PyVector` can be used as the return type for a `pycall` that ret
"""
type PyVector{T} <: AbstractVector{T}
o::PyObject
function PyVector(o::PyObject)
@compat function (::Type{PyVector{T}}){T}(o::PyObject)
if o.o == C_NULL
throw(ArgumentError("cannot make PyVector from NULL PyObject"))
end
new(o)
new{T}(o)
end
end

Expand Down Expand Up @@ -397,11 +397,11 @@ type PyDict{K,V,isdict} <: Associative{K,V}
o::PyObject
# isdict = true for python dict, otherwise is a generic Mapping object

function PyDict(o::PyObject)
@compat function (::Type{PyDict{K,V,isdict}}){K,V,isdict}(o::PyObject)
if o.o != C_NULL && pydict_query(o) == Union{}
throw(ArgumentError("only Dict and Mapping objects can be converted to PyDict"))
end
return new(o)
return new{K,V,isdict}(o)
end
end

Expand Down
8 changes: 4 additions & 4 deletions src/numpy.jl
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ type PyArray{T,N} <: AbstractArray{T,N}
c_contig::Bool
data::Ptr{T}

function PyArray(o::PyObject, info::PyArray_Info)
@compat function (::Type{PyArray{T,N}}){T,N}(o::PyObject, info::PyArray_Info)
if !aligned(info)
throw(ArgumentError("only NPY_ARRAY_ALIGNED arrays are supported"))
elseif !info.native
Expand All @@ -318,9 +318,9 @@ type PyArray{T,N} <: AbstractArray{T,N}
elseif length(info.sz) != N || length(info.st) != N
throw(ArgumentError("inconsistent ndims in PyArray constructor"))
end
return new(o, info, tuple(info.sz...), @compat(div.(info.st, sizeof(T))),
f_contiguous(info), c_contiguous(info),
convert(Ptr{T}, info.data))
return new{T,N}(o, info, tuple(info.sz...), @compat(div.(info.st, sizeof(T))),
f_contiguous(info), c_contiguous(info),
convert(Ptr{T}, info.data))
end
end

Expand Down

0 comments on commit 58d30ed

Please sign in to comment.