summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2001-11-13 08:14:27 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2001-11-13 08:14:27 +0000
commit948ff2456bc7839817ea043b42b6423538ab873c (patch)
treeb457a7351639193c4cdbbb3960c97fc079dd725d /lib
parent90ff4f01abc702b1f3376682bbaf8f4a8f6d2690 (diff)
* signal.c (sighandle): should not re-register sighandler if
POSIX_SIGNAL is defined. * eval.c (error_print): errat array may be empty. * eval.c (rb_eval_cmd): should not upgrade safe level unless explicitly specified by argument newly added. * signal.c (sig_trap): should not allow tainted trap closure. * variable.c (rb_f_trace_var): should not allow trace_var on safe level higher than 3. * variable.c (rb_f_trace_var): should not allow tainted trace closure. * gc.c: do not use static stack until system stack overflows. * eval.c (eval): should call Exception#exception instead of calling rb_exc_new3() directly. * error.c (exc_exception): set "mesg" directly to the clone. it might be better to set mesg via some method for flexibility. * variable.c (cvar_override_check): should print original module name, if 'a' is T_ICLASS. * parse.y (yylex): float '1_.0' should not be allowed. * variable.c (var_getter): should care about var as Qfalse (ruby-bugs#PR199). * array.c (cmpint): <=> or block for {min,max} may return bignum. * array.c (sort_1): use rb_compint. * array.c (sort_2): ditto. * enum.c (min_ii): ditto. * enum.c (min_ii): ditto. * enum.c (max_i): ditto. * enum.c (max_ii): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1826 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r--lib/English.rb1
-rw-r--r--lib/cgi/session.rb4
-rw-r--r--lib/delegate.rb38
3 files changed, 25 insertions, 18 deletions
diff --git a/lib/English.rb b/lib/English.rb
index c7e13bebe6..9682722027 100644
--- a/lib/English.rb
+++ b/lib/English.rb
@@ -1,4 +1,3 @@
-
alias $ERROR_INFO $!
alias $ERROR_POSITION $@
alias $LOADED_FEATURES $"
diff --git a/lib/cgi/session.rb b/lib/cgi/session.rb
index 23c9bdc2a4..bd087bb5ea 100644
--- a/lib/cgi/session.rb
+++ b/lib/cgi/session.rb
@@ -81,7 +81,7 @@ class CGI
unless @data
@data = @dbman.restore
end
- @data[key] = String(val)
+ @data[key] = val
end
def update
@@ -139,7 +139,7 @@ class CGI
def update
@f.rewind
for k,v in @hash
- @f.printf "%s=%s\n", CGI::escape(k), CGI::escape(v)
+ @f.printf "%s=%s\n", CGI::escape(k), CGI::escape(String(v))
end
@f.truncate @f.tell
end
diff --git a/lib/delegate.rb b/lib/delegate.rb
index a72ea943ba..ecc23d52ea 100644
--- a/lib/delegate.rb
+++ b/lib/delegate.rb
@@ -29,17 +29,21 @@ class Delegator
end
for method in obj.methods
next if preserved.include? method
- eval <<-EOS
- def self.#{method}(*args, &block)
- begin
- __getobj__.__send__(:#{method}, *args, &block)
- rescue Exception
- $@.delete_if{|s| /:in `__getobj__'$/ =~ s} #`
- $@.delete_if{|s| /^\\(eval\\):/ =~ s}
- raise
+ begin
+ eval <<-EOS
+ def self.#{method}(*args, &block)
+ begin
+ __getobj__.__send__(:#{method}, *args, &block)
+ rescue Exception
+ $@.delete_if{|s| /:in `__getobj__'$/ =~ s} #`
+ $@.delete_if{|s| /^\\(eval\\):/ =~ s}
+ raise
+ end
end
- end
- EOS
+ EOS
+ rescue SyntaxError
+ raise NameError, "invalid identifier %s" % method, caller(4)
+ end
end
end
@@ -81,8 +85,9 @@ def DelegateClass(superclass)
end
EOS
for method in methods
- klass.module_eval <<-EOS
- def #{method}(*args, &block)
+ begin
+ klass.module_eval <<-EOS
+ def #{method}(*args, &block)
begin
@obj.__send__(:#{method}, *args, &block)
rescue
@@ -90,10 +95,13 @@ def DelegateClass(superclass)
raise
end
end
- EOS
- end
- return klass;
+ EOS
+ rescue SyntaxError
+ raise NameError, "invalid identifier %s" % method, caller(3)
+ end
end
+ return klass;
+end
if __FILE__ == $0
class ExtArray<DelegateClass(Array)