* error.c (rb_invalid_str): prevent intermediate variable from GC.
[ruby-core:34820] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30641 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
b9c0b5039c
commit
97b8e4996f
@ -1,3 +1,8 @@
|
|||||||
|
Mon Jan 24 21:04:45 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
|
* error.c (rb_invalid_str): prevent intermediate variable from GC.
|
||||||
|
[ruby-core:34820]
|
||||||
|
|
||||||
Sun Jan 23 23:01:54 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
|
Sun Jan 23 23:01:54 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
|
||||||
|
|
||||||
* test/io/console/test_io_console.rb: Don't run test if the system
|
* test/io/console/test_io_console.rb: Don't run test if the system
|
||||||
|
2
error.c
2
error.c
@ -970,7 +970,7 @@ nometh_err_args(VALUE self)
|
|||||||
void
|
void
|
||||||
rb_invalid_str(const char *str, const char *type)
|
rb_invalid_str(const char *str, const char *type)
|
||||||
{
|
{
|
||||||
VALUE s = rb_str_inspect(rb_str_new2(str));
|
volatile VALUE s = rb_str_inspect(rb_str_new2(str));
|
||||||
|
|
||||||
rb_raise(rb_eArgError, "invalid value for %s: %s", type, RSTRING_PTR(s));
|
rb_raise(rb_eArgError, "invalid value for %s: %s", type, RSTRING_PTR(s));
|
||||||
}
|
}
|
||||||
|
@ -472,6 +472,11 @@ class TestFloat < Test::Unit::TestCase
|
|||||||
assert(Float(o).nan?)
|
assert(Float(o).nan?)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_invalid_str
|
||||||
|
bug4310 = '[ruby-core:34820]'
|
||||||
|
assert_raise(ArgumentError, bug4310) {under_gc_stress {Float('a'*10000)}}
|
||||||
|
end
|
||||||
|
|
||||||
def test_num2dbl
|
def test_num2dbl
|
||||||
assert_raise(TypeError) do
|
assert_raise(TypeError) do
|
||||||
1.0.step(2.0, "0.5") {}
|
1.0.step(2.0, "0.5") {}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user