Skip to content

Commit c5e299b

Browse files
committed
define isequal since it differs from == for Py objects, don't bother defining mixed-type comparisons to Py
1 parent a560654 commit c5e299b

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

src/PythonPlot.jl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,7 @@ end
6565
PythonCall.Py(f::Figure) = getfield(f, :o)
6666
PythonCall.pyconvert(::Type{Figure}, o::Py) = Figure(o)
6767
Base.:(==)(f::Figure, g::Figure) = pyconvert(Bool, Py(f) == Py(g))
68-
Base.:(==)(f::Figure, g::Py) = pyconvert(Bool, Py(f) == g)
69-
Base.:(==)(f::Py, g::Figure) = pyconvert(Bool, f == Py(g))
68+
Base.isequal(f::Figure, g::Figure) = isequal(Py(f), Py(g))
7069
Base.hash(f::Figure, h::UInt) = hash(Py(f), h)
7170
PythonCall.pycall(f::Figure, args...; kws...) = pycall(Py(f), args...; kws...)
7271
(f::Figure)(args...; kws...) = pycall(Py(f), PyAny, args...; kws...)

src/colormaps.jl

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,8 @@ end
1313

1414
PythonCall.Py(c::ColorMap) = getfield(c, :o)
1515
PythonCall.pyconvert(::Type{ColorMap}, o::Py) = ColorMap(o)
16-
Base.:(==)(c::ColorMap, g::ColorMap) = Py(c) == Py(g)
17-
Base.:(==)(c::Py, g::ColorMap) = c == Py(g)
18-
Base.:(==)(c::ColorMap, g::Py) = Py(c) == g
16+
Base.:(==)(c::ColorMap, g::ColorMap) = pyconvert(Bool, Py(c) == Py(g))
17+
Base.isequal(c::ColorMap, g::ColorMap) = isequal(Py(c), Py(g))
1918
Base.hash(c::ColorMap, h::UInt) = hash(Py(c), h)
2019
PythonCall.pycall(c::ColorMap, args...; kws...) = pycall(Py(c), args...; kws...)
2120
(c::ColorMap)(args...; kws...) = pycall(Py(c), args...; kws...)

0 commit comments

Comments
 (0)