зеркало из https://github.com/github/ruby.git
compile.c: fix load_from_binary
* compile.c (ibf_load_iseq_each): realpath may be nil. follow up r59709. [fix https://github.com/Shopify/bootsnap/issues/132] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62617 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
7d55ee287b
Коммит
7d34ed6ecb
|
@ -8708,7 +8708,8 @@ ibf_load_iseq_each(const struct ibf_load *load, rb_iseq_t *iseq, ibf_offset_t of
|
|||
rb_raise(rb_eRuntimeError, "path object size mismatch");
|
||||
}
|
||||
path = rb_fstring(RARRAY_AREF(pathobj, 0));
|
||||
realpath = rb_fstring(RARRAY_AREF(pathobj, 1));
|
||||
realpath = RARRAY_AREF(pathobj, 1);
|
||||
if (!NIL_P(realpath)) realpath = rb_fstring(realpath);
|
||||
}
|
||||
else {
|
||||
rb_raise(rb_eRuntimeError, "unexpected path object");
|
||||
|
|
|
@ -398,10 +398,9 @@ class TestISeq < Test::Unit::TestCase
|
|||
|
||||
def test_to_binary_with_objects
|
||||
code = "[]"+100.times.map{|i|"<</#{i}/"}.join
|
||||
bin = assert_nothing_raised {
|
||||
RubyVM::InstructionSequence.compile(code).to_binary
|
||||
}
|
||||
# load_from_binary doesn't work now
|
||||
assert_instance_of(String, bin)
|
||||
iseq = RubyVM::InstructionSequence.compile(code)
|
||||
bin = assert_nothing_raised {iseq.to_binary}
|
||||
iseq2 = RubyVM::InstructionSequence.load_from_binary(bin)
|
||||
assert_equal(iseq2.to_a, iseq.to_a)
|
||||
end
|
||||
end
|
||||
|
|
Загрузка…
Ссылка в новой задаче