✨
[Bug #19631] module_eval 内で caller_locations を参照したときのバグ報告
[Bug #19631] module_eval does not propulate absolute_path for Kernel.caller_locations
- 次のように
module_eval
内で.caller_locations
を参照したときabsolute_path
が値を返さないバグ報告
class Script < Module
script = %q{
def self.locations
Kernel.caller_locations.each { |loc|
puts "LOCATION: #{loc}"
puts "ABSPATH: #{loc.absolute_path}" # ここの値が空を返すケースがある
puts "PATH: #{loc.path}"
}
end
self.locations
}
module_eval(script, "/this/is/my/path", 0)
end
output:
LOCATION: /this/is/my/path:8:in `<class:Script>'
ABSPATH:
PATH: /this/is/my/path
LOCATION: /tmp/vY5pBJZ/18:13:in `module_eval'
ABSPATH: /tmp/vY5pBJZ/18
PATH: /tmp/vY5pBJZ/18
LOCATION: /tmp/vY5pBJZ/18:13:in `<class:Script>'
ABSPATH: /tmp/vY5pBJZ/18
PATH: /tmp/vY5pBJZ/18
LOCATION: /tmp/vY5pBJZ/18:1:in `<main>'
ABSPATH: /tmp/vY5pBJZ/18
PATH: /tmp/vY5pBJZ/18
- このチケットの起票は 2023/05/06 で約1年前のバグ報告になりますね
- このバグは手元で試した限りだと
3.0.4
以降のバージョンで再現しました
Discussion