[#84280] [Ruby trunk Bug#14181] hangs or deadlocks from waitpid, threads, and trapping SIGCHLD — nobu@...
Issue #14181 has been updated by nobu (Nobuyoshi Nakada).
3 messages
2017/12/15
[#84398] [Ruby trunk Bug#14220] WEBrick changes - failures on MSWIN, MinGW — Greg.mpls@...
Issue #14220 has been reported by MSP-Greg (Greg L).
3 messages
2017/12/22
[#84472] Re: [ruby-dev:50394] [Ruby trunk Bug#14240] warn four special variables: $; $, $/ $\ — Eric Wong <normalperson@...>
Shouldn't English posts be on ruby-core instead of ruby-dev?
3 messages
2017/12/26
[ruby-core:84547] [Ruby trunk Bug#13774] for methods defined from procs, the binding of the resulting bound_method.to_proc does not have access to the original proc's closure environment
From:
nobu@...
Date:
2017-12-28 08:21:43 UTC
List:
ruby-core #84547
Issue #13774 has been updated by nobu (Nobuyoshi Nakada).
I think it is not a bug.
Local variables are not set up in the context of a binding from a method.
```ruby
$ ruby -e 'def m(v=12);v;end; p method(:m).to_proc.binding.eval("v")'
Traceback (most recent call last):
2: from -e:1:in `<main>'
1: from -e:1:in `eval'
-e:1:in `<empty iseq>': undefined local variable or method `v' for main:Object (NameError)
```
----------------------------------------
Bug #13774: for methods defined from procs, the binding of the resulting bound_method.to_proc does not have access to the original proc's closure environment
https://bugs.ruby-lang.org/issues/13774#change-69081
* Author: bughit (bug hit)
* Status: Open
* Priority: Normal
* Assignee:
* Target version:
* ruby -v: ruby 2.5.0p0 (2017-12-25 revision 61468) [x86_64-linux]
* Backport: 2.2: UNKNOWN, 2.3: UNKNOWN, 2.4: UNKNOWN
----------------------------------------
```ruby
def foo
o = Object.new
local_var = 'local_var'
method_lambda = ->{local_var}
o.define_singleton_method(:lambda_method, &method_lambda)
method_proc = o.method(:lambda_method).to_proc
puts method_proc.()
puts eval('local_var', method_lambda.binding)
puts o.lambda_method
puts eval('local_var', method_proc.binding) # undefined local variable or method `local_var'
end
foo
```
when executed as a method it has access to local_var as expected
but the binding of the bound method proc does not
in ruby 2.2.2 the above code crashes the vm
--
https://bugs.ruby-lang.org/
Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>