Bug #19332
closedThread::Queue#pop raises ArgumentError with
Description
✓ ruby --version
ruby 3.2.0 (2022-12-25 revision a528908271) [x86_64-linux]
✓ irb
Ignoring debug-1.7.1 because its extensions are not built. Try: gem pristine debug --version 1.7.1
Ignoring rbs-2.8.2 because its extensions are not built. Try: gem pristine rbs --version 2.8.2
irb(main):001:0> require "thread"
=> false
irb(main):002:0> q = Thread::Queue.new
=> #Thread::Queue:0x00007f5ec57c2da8
irb(main):003:0> q.pop(non_block: true)
internal:thread_sync:14:in pop': unknown keyword: :non_block (ArgumentError) from (irb):3:in
'
from /home/thomas/.rubies/ruby-3.2.0/lib/ruby/gems/3.2.0/gems/irb-1.6.2/exe/irb:11:in <top (required)>' from /home/thomas/.rubies/ruby-3.2.0/bin/irb:25:in
load'··
from /home/thomas/.rubies/ruby-3.2.0/bin/irb:25:in `'
irb(main):004:0>
According to the documentation, I expected a ThreadError to be raised.
Updated by jeremyevans0 (Jeremy Evans) almost 2 years ago
- Status changed from Open to Closed
The documentation shows that non_block
is a positional argument, not a keyword argument. You want q.pop(true)
.
Updated by schnittchen (Thomas Stratmann) almost 2 years ago
Oh thanks Jeremy!