Skip to content

Commit 816a44e

Browse files
committed
avoid method ambiguity in 1.2
1 parent 207ac8e commit 816a44e

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

src/PyCall.jl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,13 +350,16 @@ function haskey(o::PyObject, s::Union{Symbol,AbstractString})
350350
return hasproperty(o, s)
351351
end
352352

353-
function hasproperty(o::PyObject, s::Union{Symbol,AbstractString})
353+
# defining hasproperty on a Union triggers a method ambiguity
354+
function pyhasproperty(o::PyObject, s::Union{Symbol,AbstractString})
354355
if ispynull(o)
355356
throw(ArgumentError("hasproperty of NULL PyObject"))
356357
end
357358
return 1 == ccall((@pysym :PyObject_HasAttrString), Cint,
358359
(PyPtr, Cstring), o, s)
359360
end
361+
hasproperty(o::PyObject, s::Symbol) = pyhasproperty(o, s)
362+
hasproperty(o::PyObject, s::AbstractString) = pyhasproperty(o, s)
360363

361364
#########################################################################
362365

0 commit comments

Comments
 (0)