forked from rubinius/rubinius
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Don't duplicate Proc objects if not needed
Currently, when its receiver is a subclass of Proc, Proc::from_env() duplicates passed objects, even if not needed. The case is that passing instances of the same subclass of Proc: class MyProc < Proc end prc = Proc.new{} my_prc = MyProc.new(&prc) # => returns an instance of MyProc duplicated from prc MyProc.new(&my_prc) # => SHOULD return my_prc, but DOESN'T, rather DOES duplicate my_prc Proc.new(&prc) # => returns prc, by comparison The problem is that there is unintended code path in which the needless duplication can happen. Thus, the duplication logic is moved from Proc::from_env() into the ruby code of Proc.new and a new primitive called proc_duplicate_as_subclass. Also revert no longer valid changes done in the following commit, which originally tried to fix this: 1abfbdf Make Proc::from_env reset klass if appropriate
- Loading branch information
Showing
5 changed files
with
21 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters