From: Charlton Wang Date: 2012-01-26T14:36:10+09:00 Subject: [ruby-core:42233] [ruby-trunk - Bug #5930] source_location of blocks incorrect Issue #5930 has been updated by Charlton Wang. I've verified this behaviour under the following versions: works: ruby 1.9.1p243 (2009-07-16 revision 24175) [i386-darwin10.4.0] fails: ruby 1.9.2p136 (2010-12-25 revision 30365) [x86_64-darwin10.4.0] works: ruby 1.9.1p243 (2009-07-16 revision 24175) [i686-linux] works: ruby 1.9.1p243 (2009-07-16 revision 24175) [x86_64-linux] fails: ruby 1.9.2p136 (2010-12-25) [x86_64-linux] ---------------------------------------- Bug #5930: source_location of blocks incorrect https://bugs.ruby-lang.org/issues/5930 Author: Charlton Wang Status: Open Priority: Normal Assignee: Category: Target version: ruby -v: 1.9.2-p136 and newer Similar to bug #2427 but maybe the opposite problem. Newer versions of ruby appear to store the source locations of blocks incorrectly when passed as an argument to a multi-line invocation of a function. Snippet of code below reveals the problem: ----- def foo(*args, &block) p block.source_location end foo(1, 2, 3) do end ----- Under ruby 1.9.1-p243: ["-", 8] Under ruby 1.9.2-p136 and newer: ["-", 5] It seems with newer versions of ruby, it reports it based on the line on which the function is called instead of where the actual block is. I believe the old behaviour is actually the correct behaviour. Charlton -- http://bugs.ruby-lang.org/