Skip to content

Commit 4b812e3

Browse files
authored
Delete unnecessary comparison operators (#698)
* Delete unnecessary comparison operators These are already defined by Base in terms of other comparison operators, so they cause a ton of invalidations. * use :static scheduler for GIL tests possible fix for CI crashes seen in these tests --------- Co-authored-by: Christopher Doris <github.com/cjdoris>
1 parent 59a16f9 commit 4b812e3

File tree

2 files changed

+2
-11
lines changed

2 files changed

+2
-11
lines changed

src/Core/Py.jl

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -364,30 +364,21 @@ Base.broadcastable(x::Py) = Ref(x)
364364

365365
# comparisons
366366
Base.:(==)(x::Py, y::Py) = pyeq(Bool, x, y)
367-
Base.:(!=)(x::Py, y::Py) = pyne(Bool, x, y)
368367
Base.:(<=)(x::Py, y::Py) = pyle(Bool, x, y)
369368
Base.:(<)(x::Py, y::Py) = pylt(Bool, x, y)
370-
Base.:(>=)(x::Py, y::Py) = pyge(Bool, x, y)
371-
Base.:(>)(x::Py, y::Py) = pygt(Bool, x, y)
372369
Base.isless(x::Py, y::Py) = pylt(Bool, x, y)
373370
Base.isequal(x::Py, y::Py) = pyeq(Bool, x, y)
374371

375372
# we also allow comparison with numbers
376373
Base.:(==)(x::Py, y::Number) = pyeq(Bool, x, y)
377-
Base.:(!=)(x::Py, y::Number) = pyne(Bool, x, y)
378374
Base.:(<=)(x::Py, y::Number) = pyle(Bool, x, y)
379375
Base.:(<)(x::Py, y::Number) = pylt(Bool, x, y)
380-
Base.:(>=)(x::Py, y::Number) = pyge(Bool, x, y)
381-
Base.:(>)(x::Py, y::Number) = pygt(Bool, x, y)
382376
Base.isless(x::Py, y::Number) = pylt(Bool, x, y)
383377
Base.isequal(x::Py, y::Number) = pyeq(Bool, x, y)
384378

385379
Base.:(==)(x::Number, y::Py) = pyeq(Bool, x, y)
386-
Base.:(!=)(x::Number, y::Py) = pyne(Bool, x, y)
387380
Base.:(<=)(x::Number, y::Py) = pyle(Bool, x, y)
388381
Base.:(<)(x::Number, y::Py) = pylt(Bool, x, y)
389-
Base.:(>=)(x::Number, y::Py) = pyge(Bool, x, y)
390-
Base.:(>)(x::Number, y::Py) = pygt(Bool, x, y)
391382
Base.isless(x::Number, y::Py) = pylt(Bool, x, y)
392383
Base.isequal(x::Number, y::Py) = pyeq(Bool, x, y)
393384

test/GIL.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# GIL, these can happen in parallel if Julia has at least 2 threads.
44
function threaded_sleep()
55
PythonCall.GIL.unlock() do
6-
Threads.@threads for i = 1:2
6+
Threads.@threads :static for i = 1:2
77
PythonCall.GIL.lock() do
88
pyimport("time").sleep(1)
99
end
@@ -24,7 +24,7 @@ end
2424
# This calls Python's time.sleep(1) twice concurrently. Since sleep() unlocks the
2525
# GIL, these can happen in parallel if Julia has at least 2 threads.
2626
function threaded_sleep()
27-
PythonCall.GIL.@unlock Threads.@threads for i = 1:2
27+
PythonCall.GIL.@unlock Threads.@threads :static for i = 1:2
2828
PythonCall.GIL.@lock pyimport("time").sleep(1)
2929
end
3030
end

0 commit comments

Comments
 (0)