From: mame@... Date: 2015-10-14T19:17:59+00:00 Subject: [ruby-core:71088] [Ruby trunk - Bug #11594] [Assigned] A Proc call may corrupt a local variable Issue #11594 has been reported by Yusuke Endoh. ---------------------------------------- Bug #11594: A Proc call may corrupt a local variable https://bugs.ruby-lang.org/issues/11594 * Author: Yusuke Endoh * Status: Assigned * Priority: Normal * Assignee: Nobuyoshi Nakada * ruby -v: ruby 2.3.0dev (2015-10-15 master 52128) [x86_64-linux] * Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN ---------------------------------------- ~~~~ x, y, z = 1, 2, 3 p [x, y, z] #=> [1, 2, 3] -> &blk { }.call &:foo p [x, y, z] #=> [false, 2, 3] !!! WRONG !!! ~~~~ The proc call in Line 3 modifies a local variable. git bisect showed r52056. I confirmed it worked fine when I revert the commit. * `rb_sym_to_proc` creates a Proc instance, * `rb_sym_to_proc` calls `rb_block_clear_env_self`, and * `rb_block_clear_env_self` seems to break the variable, instead of clearing self. I guess `rb_sym_to_proc` creates an inconsistent Proc, but I don't know what is happening precisely. -- Yusuke Endoh -- https://bugs.ruby-lang.org/