From 82e8e747df8e9b5ab184b446b0ccf4f80e6b743b Mon Sep 17 00:00:00 2001 From: matz Date: Mon, 12 Sep 2005 16:21:50 +0000 Subject: [PATCH] * eval.c (proc_save_safe_level): no need to restrict safe level memoize in $SAFE>=3. [ruby-dev:27050] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9135 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 5 +++++ eval.c | 8 +++----- test/socket/test_socket.rb | 8 ++++---- test/socket/test_udp.rb | 4 ++-- test/testunit/test_assertions.rb | 1 - 5 files changed, 14 insertions(+), 12 deletions(-) diff --git a/ChangeLog b/ChangeLog index c4708b3c04..ec96e958a6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Tue Sep 13 01:17:45 2005 Yukihiro Matsumoto + + * eval.c (proc_save_safe_level): no need to restrict safe level + memoize in $SAFE>=3. [ruby-dev:27050] + Tue Sep 13 00:02:33 2005 Nobuyoshi Nakada * file.c (apply2files): stricter callback definition. diff --git a/eval.c b/eval.c index 831b759a31..d25120d147 100644 --- a/eval.c +++ b/eval.c @@ -7968,11 +7968,9 @@ bind_eval(int argc, VALUE *argv, VALUE bind) static void proc_save_safe_level(VALUE data) { - if (ruby_safe_level >= 3) { - int safe = ruby_safe_level; - if (safe > PROC_TMAX) safe = PROC_TMAX; - FL_SET(data, (safe << PROC_TSHIFT) & PROC_TMASK); - } + int safe = ruby_safe_level; + if (safe > PROC_TMAX) safe = PROC_TMAX; + FL_SET(data, (safe << PROC_TSHIFT) & PROC_TMASK); } static int diff --git a/test/socket/test_socket.rb b/test/socket/test_socket.rb index 11d688ba75..5724938f6b 100644 --- a/test/socket/test_socket.rb +++ b/test/socket/test_socket.rb @@ -19,7 +19,7 @@ class TestBasicSocket < Test::Unit::TestCase n = s.getsockopt(Socket::SOL_SOCKET, Socket::SO_ERROR) assert_equal([0].pack("i"), n) val = Object.new - class << val; self end.send(:define_method, :to_int) { + class << val; self end.fcall(:define_method, :to_int) { s.close Socket::SO_TYPE } @@ -34,7 +34,7 @@ class TestBasicSocket < Test::Unit::TestCase linger = [0, 0].pack("ii") val = Object.new - class << val; self end.send(:define_method, :to_str) { + class << val; self end.fcall(:define_method, :to_str) { s.close linger } @@ -47,7 +47,7 @@ class TestBasicSocket < Test::Unit::TestCase end val = Object.new - class << val; self end.send(:define_method, :to_int) { + class << val; self end.fcall(:define_method, :to_int) { s.close Socket::SO_LINGER } @@ -61,7 +61,7 @@ class TestBasicSocket < Test::Unit::TestCase def test_listen s = nil log = Object.new - class << log; self end.send(:define_method, :to_int) { + class << log; self end.fcall(:define_method, :to_int) { s.close 2 } diff --git a/test/socket/test_udp.rb b/test/socket/test_udp.rb index 07fd17a2cb..3f5f55a467 100644 --- a/test/socket/test_udp.rb +++ b/test/socket/test_udp.rb @@ -9,7 +9,7 @@ class TestUDPSocket < Test::Unit::TestCase def test_connect # [ruby-dev:25045] s = UDPSocket.new host = Object.new - class << host; self end.send(:define_method, :to_str) { + class << host; self end.fcall(:define_method, :to_str) { s.close "127.0.0.1" } @@ -21,7 +21,7 @@ class TestUDPSocket < Test::Unit::TestCase def test_bind # [ruby-dev:25057] s = UDPSocket.new host = Object.new - class << host; self end.send(:define_method, :to_str) { + class << host; self end.fcall(:define_method, :to_str) { s.close "127.0.0.1" } diff --git a/test/testunit/test_assertions.rb b/test/testunit/test_assertions.rb index 8ccd2a81bd..19b4963946 100644 --- a/test/testunit/test_assertions.rb +++ b/test/testunit/test_assertions.rb @@ -483,7 +483,6 @@ Message: <"Error"> def test_assert_send object = Object.new class << object - private def return_argument(argument, bogus) return argument end