-
-
Notifications
You must be signed in to change notification settings - Fork 942
Closed
Milestone
Description
Hello again!
I'm using Thread#backtrace_locations and noticed several differences between MRI and JRuby.
I'll report them separately because they may have different fixes, but feel free to mark any as duplicate if it makes sense to do so.
Environment
- JRuby:
jruby 9.1.17.0 (2.3.3) 2018-04-20 d8b1ff9 Java HotSpot(TM) 64-Bit Server VM 25.171-b11 on 1.8.0_171-b11 +jit [linux-x86_64] - Kernel:
Linux u186024434db159d25c92 4.13.0-39-generic #44~16.04.1-Ubuntu SMP Thu Apr 5 16:43:10 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux - Distro:
Ubuntu 16.04.4 LTS
Expected Behavior
When looking at a Thread::Backtrace::Location, MRI provides both #base_label and #label.
For most methods, these are exactly the same, but for blocks it allows the caller to get the name of the method separate from the "block in" text without resorting to parsing the result.
Testcase:
puts RUBY_DESCRIPTION
def test
[:test].map do
location = Thread.current.backtrace_locations[1]
puts "#base_label '#{location.base_label}', #label '#{location.label}'"
end
end
testOutput on MRI:
ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-linux]
#base_label 'test', #label 'block in test'
Actual Behavior
JRuby does not make such a distinction, and so base_label effectively becomes an alias of label:
jruby 9.1.17.0 (2.3.3) 2018-04-20 d8b1ff9 Java HotSpot(TM) 64-Bit Server VM 25.171-b11 on 1.8.0_171-b11 +jit [linux-x86_64]
#base_label 'block in test', #label 'block in test'
If it would be helpful I can also submit a testcase to RubySpec.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels