1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* hash.c (rb_any_cmp): should handle Qundef in keys.

* eval.c (remove_method): should not remove a empty method to
  implement "undef".

* eval.c (rb_eval): should allow singleton class def for
  true/false/nil.

* parse.y (str_extend): backslash escape was done wrong.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2102 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2002-02-20 04:31:50 +00:00
parent dc7f9c1f89
commit c46468d773
5 changed files with 36 additions and 10 deletions

View file

@ -1,3 +1,13 @@
Wed Feb 20 12:41:59 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
* hash.c (rb_any_cmp): should handle Qundef in keys.
* eval.c (remove_method): should not remove a empty method to
implement "undef".
* eval.c (rb_eval): should allow singleton class def for
true/false/nil.
Tue Feb 19 21:43:32 2002 Minero Aoki <aamine@loveruby.net>
* lib/net/protocol.rb: rename Protocol.port to default_port.
@ -58,6 +68,10 @@ Tue Feb 19 21:43:32 2002 Minero Aoki <aamine@loveruby.net>
* lib/net/http.rb: proxy related class-instance-variables are not
initialized correctly.
Tue Feb 19 20:20:12 2002 Ed Sinjiashvili <edsin@swes.saren.ru>
* parse.y (str_extend): backslash escape was done wrong.
Tue Feb 19 17:10:25 2002 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
* file.c (path_check_1): do not fail on world writable *parent*

27
eval.c
View file

@ -311,7 +311,7 @@ remove_method(klass, mid)
rb_raise(rb_eSecurityError, "Insecure: can't remove method");
}
if (OBJ_FROZEN(klass)) rb_error_frozen("class/module");
if (!st_delete(RCLASS(klass)->m_tbl, &mid, &body)) {
if (!st_delete(RCLASS(klass)->m_tbl, &mid, &body) || !body->nd_body) {
rb_name_error(mid, "method `%s' not defined in %s",
rb_id2name(mid), rb_class2name(klass));
}
@ -3301,14 +3301,25 @@ rb_eval(self, n)
{
VALUE klass;
klass = rb_eval(self, node->nd_recv);
if (rb_special_const_p(klass)) {
rb_raise(rb_eTypeError, "no virtual class for %s",
rb_class2name(CLASS_OF(klass)));
result = rb_eval(self, node->nd_recv);
if (result == Qtrue) {
klass = rb_cTrueClass;
}
else if (result == Qfalse) {
klass = rb_cTrueClass;
}
else if (result == Qnil) {
klass = rb_cNilClass;
}
else {
if (rb_special_const_p(result)) {
rb_raise(rb_eTypeError, "no virtual class for %s",
rb_class2name(CLASS_OF(klass)));
}
if (rb_safe_level() >= 4 && !OBJ_TAINTED(result))
rb_raise(rb_eSecurityError, "Insecure: can't extend object");
klass = rb_singleton_class(result);
}
if (rb_safe_level() >= 4 && !OBJ_TAINTED(klass))
rb_raise(rb_eSecurityError, "Insecure: can't extend object");
klass = rb_singleton_class(klass);
if (ruby_wrapper) {
rb_extend_object(klass, ruby_wrapper);

1
hash.c
View file

@ -70,6 +70,7 @@ rb_any_cmp(a, b)
if (SYMBOL_P(a) && SYMBOL_P(b)) {
return a != b;
}
if (a == Qundef || b == Qundef) return -1;
args[0] = a;
args[1] = b;

2
io.c
View file

@ -1165,7 +1165,7 @@ rb_io_close(io)
int fd;
fptr = RFILE(io)->fptr;
if (!fptr) return;
if (!fptr) return Qnil;
if (!fptr->f && !fptr->f2) return;
fd = fileno(fptr->f);

View file

@ -4101,7 +4101,7 @@ str_extend(list, term, paren)
tokadd('\\');
tokadd(c);
}
break;
goto loop_again;
case '{':
if (brace != -1) brace_nest++;
default: