Project

General

Profile

Backport #2099

Error when getting binding for a method via converting it to a Proc

Added by webnov8 (Todd A) over 9 years ago. Updated almost 8 years ago.

Status:
Closed
Priority:
Normal
[ruby-core:25589]

Description

=begin
Not sure if this is allowed in Ruby 1.9.1 but from a poll on #ruby-lang it seems like it works in 1.8. I am running 1.9.1p243 and the following throws an argument error:

class Foo
def bar
a = 'apple'
b= 22
puts 'inside bar'
end
end

obj = Foo.new
pro = obj.method(:bar).to_proc
pro.call # 'inside bar'

b = pro.binding # Can't create Binding from C level Proc (ArgumentError)
=end


Related issues

Related to Ruby trunk - Bug #10428: Segmentation fault when modifying local variables of binding obtained from the result of Method#to_procClosed10/26/2014Actions

Associated revisions

Revision 223a2846
Added by yugui (Yuki Sonoda) over 9 years ago

merges r25967, r25968 and r25969 from trunk into ruby_1_9_1. fixes a backport task #2099.

  • parse.y (dyna_push_gen, dyna_pop_gen): adjust local vtable level for the case of syntax errors in method name or argument inside do block. [ruby-core:26961] --
  • parse.y (dyna_push_gen): use rb_node_newnode() for ripper. [ruby-core:26961] --
  • parse.y (dyna_push_gen, dyna_pop_gen): no needs to save both of args and vars. [ruby-core:26961]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_1@26014 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

History

#1

Updated by nobu (Nobuyoshi Nakada) over 9 years ago

  • Status changed from Open to Closed

=begin
Applied in changeset r25015.
=end

#2

Updated by nobu (Nobuyoshi Nakada) over 9 years ago

  • Status changed from Closed to Assigned
  • Assignee set to yugui (Yuki Sonoda)
  • Priority changed from 5 to Normal

=begin

=end

#3

Updated by yugui (Yuki Sonoda) over 9 years ago

  • Status changed from Assigned to Closed
  • % Done changed from 0 to 100

=begin
This issue was solved with changeset r26014.
Todd, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.

=end

Updated by nobu (Nobuyoshi Nakada) over 4 years ago

  • Related to Bug #10428: Segmentation fault when modifying local variables of binding obtained from the result of Method#to_proc added

Also available in: Atom PDF