Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions src/Core/Py.jl
Original file line number Diff line number Diff line change
Expand Up @@ -364,30 +364,21 @@ Base.broadcastable(x::Py) = Ref(x)

# comparisons
Base.:(==)(x::Py, y::Py) = pyeq(Bool, x, y)
Base.:(!=)(x::Py, y::Py) = pyne(Bool, x, y)
Base.:(<=)(x::Py, y::Py) = pyle(Bool, x, y)
Base.:(<)(x::Py, y::Py) = pylt(Bool, x, y)
Base.:(>=)(x::Py, y::Py) = pyge(Bool, x, y)
Base.:(>)(x::Py, y::Py) = pygt(Bool, x, y)
Base.isless(x::Py, y::Py) = pylt(Bool, x, y)
Base.isequal(x::Py, y::Py) = pyeq(Bool, x, y)

# we also allow comparison with numbers
Base.:(==)(x::Py, y::Number) = pyeq(Bool, x, y)
Base.:(!=)(x::Py, y::Number) = pyne(Bool, x, y)
Base.:(<=)(x::Py, y::Number) = pyle(Bool, x, y)
Base.:(<)(x::Py, y::Number) = pylt(Bool, x, y)
Base.:(>=)(x::Py, y::Number) = pyge(Bool, x, y)
Base.:(>)(x::Py, y::Number) = pygt(Bool, x, y)
Base.isless(x::Py, y::Number) = pylt(Bool, x, y)
Base.isequal(x::Py, y::Number) = pyeq(Bool, x, y)

Base.:(==)(x::Number, y::Py) = pyeq(Bool, x, y)
Base.:(!=)(x::Number, y::Py) = pyne(Bool, x, y)
Base.:(<=)(x::Number, y::Py) = pyle(Bool, x, y)
Base.:(<)(x::Number, y::Py) = pylt(Bool, x, y)
Base.:(>=)(x::Number, y::Py) = pyge(Bool, x, y)
Base.:(>)(x::Number, y::Py) = pygt(Bool, x, y)
Base.isless(x::Number, y::Py) = pylt(Bool, x, y)
Base.isequal(x::Number, y::Py) = pyeq(Bool, x, y)

Expand Down
4 changes: 2 additions & 2 deletions test/GIL.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# GIL, these can happen in parallel if Julia has at least 2 threads.
function threaded_sleep()
PythonCall.GIL.unlock() do
Threads.@threads for i = 1:2
Threads.@threads :static for i = 1:2
PythonCall.GIL.lock() do
pyimport("time").sleep(1)
end
Expand All @@ -24,7 +24,7 @@ end
# This calls Python's time.sleep(1) twice concurrently. Since sleep() unlocks the
# GIL, these can happen in parallel if Julia has at least 2 threads.
function threaded_sleep()
PythonCall.GIL.@unlock Threads.@threads for i = 1:2
PythonCall.GIL.@unlock Threads.@threads :static for i = 1:2
PythonCall.GIL.@lock pyimport("time").sleep(1)
end
end
Expand Down
Loading