зеркало из https://github.com/github/ruby.git
proc.c: fix infinite loop
* proc.c (rb_proc_get_iseq): proc made from symbol does not have iseq. fix infinite loop. [ruby-core:72381] [Bug #11845] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53206 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
ea46a6408c
Коммит
2d97cee4d5
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
|||
Sun Dec 20 00:29:00 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* proc.c (rb_proc_get_iseq): proc made from symbol does not have
|
||||
iseq. fix infinite loop. [ruby-core:72381] [Bug #11845]
|
||||
|
||||
Sun Dec 20 00:28:51 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* proc.c (rb_proc_get_iseq): proc made from symbol does not have
|
||||
iseq. fix infinite loop. [ruby-core:72381] [Bug #11845]
|
||||
|
||||
Sat Dec 19 20:06:10 2015 Naohisa Goto <ngotogenome@gmail.com>
|
||||
|
||||
* enc/windows_1250.c: Should not use C++ style comments (C99 feature).
|
||||
|
|
4
proc.c
4
proc.c
|
@ -975,7 +975,6 @@ rb_proc_get_iseq(VALUE self, int *is_proc)
|
|||
const rb_proc_t *proc;
|
||||
const rb_iseq_t *iseq;
|
||||
|
||||
again:
|
||||
GetProcPtr(self, proc);
|
||||
iseq = proc->block.iseq;
|
||||
if (is_proc) *is_proc = !proc->is_lambda;
|
||||
|
@ -990,8 +989,7 @@ rb_proc_get_iseq(VALUE self, int *is_proc)
|
|||
return iseq;
|
||||
}
|
||||
else if (SYMBOL_P(iseq)) {
|
||||
self = rb_sym_to_proc((VALUE)iseq);
|
||||
goto again;
|
||||
return NULL;
|
||||
}
|
||||
else {
|
||||
return rb_iseq_check(iseq);
|
||||
|
|
|
@ -164,6 +164,18 @@ class TestSymbol < Test::Unit::TestCase
|
|||
end;
|
||||
end
|
||||
|
||||
def test_to_proc_iseq
|
||||
assert_separately([], <<~"end;", timeout: 1) # do
|
||||
bug11845 = '[ruby-core:72381] [Bug #11845]'
|
||||
assert_nil(:class.to_proc.source_location, bug11845)
|
||||
assert_equal([[:rest]], :class.to_proc.parameters, bug11845)
|
||||
c = Class.new {define_method(:klass, :class.to_proc)}
|
||||
m = c.instance_method(:klass)
|
||||
assert_nil(m.source_location, bug11845)
|
||||
assert_equal([[:rest]], m.parameters, bug11845)
|
||||
end;
|
||||
end
|
||||
|
||||
def test_call
|
||||
o = Object.new
|
||||
def o.foo(x, y); x + y; end
|
||||
|
|
Загрузка…
Ссылка в новой задаче