summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog33
-rw-r--r--bignum.c8
-rw-r--r--env.h1
-rw-r--r--eval.c45
-rw-r--r--ext/extmk.rb.in1
-rw-r--r--file.c10
-rw-r--r--gc.c5
-rw-r--r--hash.c8
-rw-r--r--lib/cgi.rb2
-rw-r--r--object.c12
-rw-r--r--version.h4
11 files changed, 86 insertions, 43 deletions
diff --git a/ChangeLog b/ChangeLog
index 493053832..8b415da3e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -10,6 +10,14 @@ Sun Aug 11 09:34:07 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
* marshal.c (r_object): register TYPE_BIGNUM regardless real type.
+Sat Aug 10 23:47:16 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * bignum.c (rb_big_cmp): use dbl2big() for Floats, instead of
+ big2dbl().
+
+ * bignum.c (Init_Bignum): rb_big_zero_p() removed. There may be
+ Bignum zero.
+
Fri Aug 9 13:31:40 2002 WATANABE Hirofumi <eban@ruby-lang.org>
* ext/Win32API/extconf.rb: check existence of <windows.h>.
@@ -20,6 +28,23 @@ Thu Aug 8 09:37:02 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
* lib/optparse.rb (String): ditto.
+Thu Aug 8 00:45:15 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_call0): new argument added for original method name.
+ preserve original method name in frame->orig_func.
+
+ * eval.c (is_defined): use frame->orig_func, not last_func.
+
+ * eval.c (rb_eval): ditto.
+
+ * eval.c (method_call): supply data->oid also to rb_call0().
+
+ * object.c (rb_class_allocate_instance): call rb_obj_alloc() when
+ called from alias, thus invoke original "allocate".
+
+ * eval.c (remove_method): removing allocate from classes should
+ cause NameError.
+
Wed Aug 7 22:12:54 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
* lib/optparse.rb (OptionParser::Completion::convert): returned
@@ -35,6 +60,10 @@ Wed Aug 7 22:12:54 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
* lib/optparse/uri.rb: require standard uri module. thanks to
Minero Aoki.
+Wed Aug 7 09:51:54 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * hash.c (rb_hash_equal): should check default values.
+
Wed Aug 7 08:44:32 2002 Minero Aoki <aamine@loveruby.net>
* ext/racc/cparse/cparse.c: reduce goto.
@@ -65,6 +94,10 @@ Fri Aug 2 09:12:32 2002 Minero Aoki <aamine@loveruby.net>
* ext/strscan/strscan.c: follow allocation framework.
+Fri Aug 2 01:21:52 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * ext/socket/socket.c (s_recvfrom): update RSTRING len.
+
Thu Aug 1 17:47:15 2002 Tachino Nobuhiro <tachino@jp.fujitsu.com>
* parse.y (tokadd_string): ignore backslashed spaces in %w.
diff --git a/bignum.c b/bignum.c
index 26036775e..ad1b2ca1c 100644
--- a/bignum.c
+++ b/bignum.c
@@ -1700,13 +1700,6 @@ rb_big_size(big)
return INT2FIX(RBIGNUM(big)->len*SIZEOF_BDIGITS);
}
-static VALUE
-rb_big_zero_p(big)
- VALUE big;
-{
- return Qfalse;
-}
-
void
Init_Bignum()
{
@@ -1740,5 +1733,4 @@ Init_Bignum()
rb_define_method(rb_cBignum, "to_f", rb_big_to_f, 0);
rb_define_method(rb_cBignum, "abs", rb_big_abs, 0);
rb_define_method(rb_cBignum, "size", rb_big_size, 0);
- rb_define_method(rb_cBignum, "zero?", rb_big_zero_p, 0);
}
diff --git a/env.h b/env.h
index b185d1262..c3b6d20b5 100644
--- a/env.h
+++ b/env.h
@@ -18,6 +18,7 @@ extern struct FRAME {
int argc;
VALUE *argv;
ID last_func;
+ ID orig_func;
VALUE last_class;
VALUE cbase;
struct FRAME *prev;
diff --git a/eval.c b/eval.c
index 4a1aaefda..8de0756c2 100644
--- a/eval.c
+++ b/eval.c
@@ -315,6 +315,10 @@ rb_get_method_body(klassp, idp, noexp)
return body;
}
+static ID init, alloc, eqq, each, aref, aset, match, missing;
+static ID added, singleton_added;
+static ID __id__, __send__;
+
static void
remove_method(klass, mid)
VALUE klass;
@@ -329,6 +333,16 @@ remove_method(klass, mid)
rb_raise(rb_eSecurityError, "Insecure: can't remove method");
}
if (OBJ_FROZEN(klass)) rb_error_frozen("class/module");
+ if (mid == __id__ || mid == __send__ || mid == init) {
+ rb_warn("removing `%s' may cause serious problem", rb_id2name(mid));
+ }
+ if (mid == alloc) {
+ if (klass == rb_cClass ||
+ (FL_TEST(klass, FL_SINGLETON) &&
+ rb_obj_is_kind_of(rb_iv_get(klass, "__attached__"), rb_cClass))) {
+ rb_name_error(mid, "removing `%s'", rb_id2name(mid));
+ }
+ }
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));
@@ -454,10 +468,6 @@ rb_method_boundp(klass, id, ex)
return Qfalse;
}
-static ID init, alloc, eqq, each, aref, aset, match, missing;
-static ID added, singleton_added;
-static ID __id__, __send__;
-
void
rb_attr(klass, id, read, write, ex)
VALUE klass;
@@ -1324,6 +1334,7 @@ rb_eval_string_wrap(str, state)
rb_extend_object(ruby_top_self, ruby_wrapper);
PUSH_FRAME();
ruby_frame->last_func = 0;
+ ruby_frame->orig_func = 0;
ruby_frame->last_class = 0;
ruby_frame->self = self;
ruby_frame->cbase = (VALUE)rb_node_newnode(NODE_CREF,ruby_wrapper,0,0);
@@ -1415,6 +1426,7 @@ rb_eval_cmd(cmd, arg, tcheck)
ruby_scope = top_scope;
PUSH_FRAME();
ruby_frame->last_func = 0;
+ ruby_frame->orig_func = 0;
ruby_frame->last_class = 0;
ruby_frame->self = ruby_top_self;
ruby_frame->cbase = (VALUE)rb_node_newnode(NODE_CREF,0,0,0);
@@ -1621,13 +1633,10 @@ rb_undef(klass, id)
rb_secure(4);
}
if (ruby_safe_level >= 4 && !OBJ_TAINTED(klass)) {
- rb_raise(rb_eSecurityError, "Insecure: can't undef");
- if (id == __id__ || id == __send__ || id == init) {
- rb_name_error(id, "undefining `%s' prohibited", rb_id2name(id));
- }
+ rb_raise(rb_eSecurityError, "Insecure: can't undef `%s'", rb_id2name(id));
}
rb_frozen_class_p(klass);
- if (id == __id__ || id == __send__ || id == init) {
+ if (id == __id__ || id == __send__ || id == init || id == alloc) {
rb_warn("undefining `%s' may cause serious problem", rb_id2name(id));
}
body = search_method(klass, id, &origin);
@@ -1844,10 +1853,10 @@ is_defined(self, node, buf)
switch (nd_type(node)) {
case NODE_SUPER:
case NODE_ZSUPER:
- if (ruby_frame->last_func == 0) return 0;
+ if (ruby_frame->orig_func == 0) return 0;
else if (ruby_frame->last_class == 0) return 0;
else if (rb_method_boundp(RCLASS(ruby_frame->last_class)->super,
- ruby_frame->last_func, 0)) {
+ ruby_frame->orig_func, 0)) {
if (nd_type(node) == NODE_SUPER) {
return arg_defined(self, node->nd_args, buf, "super");
}
@@ -2759,10 +2768,10 @@ rb_eval(self, n)
TMP_PROTECT;
if (ruby_frame->last_class == 0) {
- if (ruby_frame->last_func) {
+ if (ruby_frame->orig_func) {
rb_name_error(ruby_frame->last_func,
"superclass method `%s' disabled",
- rb_id2name(ruby_frame->last_func));
+ rb_id2name(ruby_frame->orig_func));
}
else {
rb_raise(rb_eNoMethodError, "super called outside of method");
@@ -2780,7 +2789,7 @@ rb_eval(self, n)
PUSH_ITER(ruby_iter->iter?ITER_PRE:ITER_NOT);
result = rb_call(RCLASS(ruby_frame->last_class)->super,
- ruby_frame->self, ruby_frame->last_func,
+ ruby_frame->self, ruby_frame->orig_func,
argc, argv, 3);
POP_ITER();
}
@@ -4458,9 +4467,10 @@ call_cfunc(func, recv, len, argc, argv)
}
static VALUE
-rb_call0(klass, recv, id, argc, argv, body, nosuper)
+rb_call0(klass, recv, id, oid, argc, argv, body, nosuper)
VALUE klass, recv;
ID id;
+ ID oid;
int argc; /* OK */
VALUE *argv; /* OK */
NODE *body; /* OK */
@@ -4490,6 +4500,7 @@ rb_call0(klass, recv, id, argc, argv, body, nosuper)
PUSH_FRAME();
ruby_frame->last_func = id;
+ ruby_frame->orig_func = oid;
ruby_frame->last_class = nosuper?0:klass;
ruby_frame->self = recv;
ruby_frame->argc = argc;
@@ -4747,7 +4758,7 @@ rb_call(klass, recv, mid, argc, argv, scope)
}
}
- return rb_call0(klass, recv, id, argc, argv, body, noex & NOEX_UNDEF);
+ return rb_call0(klass, recv, mid, id, argc, argv, body, noex & NOEX_UNDEF);
}
VALUE
@@ -6914,7 +6925,7 @@ method_call(argc, argv, method)
ruby_safe_level = 4;
}
if ((state = EXEC_TAG()) == 0) {
- result = rb_call0(data->klass,data->recv,data->id,argc,argv,data->body,0);
+ result = rb_call0(data->klass,data->recv,data->id,data->oid,argc,argv,data->body,0);
}
POP_TAG();
POP_ITER();
diff --git a/ext/extmk.rb.in b/ext/extmk.rb.in
index ab1b78a4c..a8bcafa0b 100644
--- a/ext/extmk.rb.in
+++ b/ext/extmk.rb.in
@@ -708,6 +708,7 @@ def extmake(target)
end
end
end
+ $static = $target if $static
if File.exist?("./Makefile")
if $static
$extlist.push [$static, File.basename($target)]
diff --git a/file.c b/file.c
index 33b9cc985..87f3cc63c 100644
--- a/file.c
+++ b/file.c
@@ -214,7 +214,7 @@ rb_stat_rdev(self)
#ifdef HAVE_ST_RDEV
return ULONG2NUM(get_stat(self)->st_rdev);
#else
- return INT2FIX(0);
+ return Qnil;
#endif
}
@@ -226,7 +226,7 @@ rb_stat_rdev_major(self)
long rdev = get_stat(self)->st_rdev;
return ULONG2NUM(major(rdev));
#else
- return INT2FIX(0);
+ return Qnil;
#endif
}
@@ -238,7 +238,7 @@ rb_stat_rdev_minor(self)
long rdev = get_stat(self)->st_rdev;
return ULONG2NUM(minor(rdev));
#else
- return INT2FIX(0);
+ return Qnil;
#endif
}
@@ -256,7 +256,7 @@ rb_stat_blksize(self)
#ifdef HAVE_ST_BLKSIZE
return ULONG2NUM(get_stat(self)->st_blksize);
#else
- return INT2FIX(0);
+ return Qnil;
#endif
}
@@ -267,7 +267,7 @@ rb_stat_blocks(self)
#ifdef HAVE_ST_BLOCKS
return ULONG2NUM(get_stat(self)->st_blocks);
#else
- return INT2FIX(0);
+ return Qnil;
#endif
}
diff --git a/gc.c b/gc.c
index 9a17078e1..f84f27578 100644
--- a/gc.c
+++ b/gc.c
@@ -33,11 +33,8 @@
void re_free_registers _((struct re_registers*));
void rb_io_fptr_finalize _((struct OpenFile*));
-#ifndef setjmp
-#ifdef HAVE__SETJMP
+#if !defined(setjmp) && defined(HAVE__SETJMP)
#define setjmp(env) _setjmp(env)
-#define longjmp(env,val) _longjmp(env,val)
-#endif
#endif
/* Make alloca work the best possible way. */
diff --git a/hash.c b/hash.c
index 5cc3638b8..98bf3427f 100644
--- a/hash.c
+++ b/hash.c
@@ -24,6 +24,7 @@ static void
rb_hash_modify(hash)
VALUE hash;
{
+ if (!RHASH(hash)->tbl) rb_raise(rb_eTypeError, "uninitialized Hash");
if (OBJ_FROZEN(hash)) rb_error_frozen("hash");
if (!OBJ_TAINTED(hash) && rb_safe_level() >= 4)
rb_raise(rb_eSecurityError, "Insecure: can't modify hash");
@@ -226,7 +227,7 @@ rb_hash_s_create(argc, argv, klass)
int i;
if (argc == 1 && TYPE(argv[0]) == T_HASH) {
- VALUE hash = rb_obj_alloc(klass);
+ hash = rb_obj_alloc(klass);
RHASH(hash)->ifnone = Qnil;
RHASH(hash)->tbl = st_copy(RHASH(argv[0])->tbl);
@@ -237,8 +238,8 @@ rb_hash_s_create(argc, argv, klass)
if (argc % 2 != 0) {
rb_raise(rb_eArgError, "odd number args for Hash");
}
- hash = rb_hash_s_alloc(klass);
+ hash = rb_obj_alloc(klass);
for (i=0; i<argc; i+=2) {
rb_hash_aset(hash, argv[i], argv[i + 1]);
}
@@ -280,6 +281,7 @@ rb_hash_rehash(hash)
{
st_table *tbl;
+ rb_hash_modify(hash);
tbl = st_init_table_with_size(&objhash, RHASH(hash)->tbl->num_entries);
st_foreach(RHASH(hash)->tbl, rb_hash_rehash_i, tbl);
st_free_table(RHASH(hash)->tbl);
@@ -852,6 +854,8 @@ rb_hash_equal(hash1, hash2)
if (TYPE(hash2) != T_HASH) return Qfalse;
if (RHASH(hash1)->tbl->num_entries != RHASH(hash2)->tbl->num_entries)
return Qfalse;
+ if (!rb_equal(RHASH(hash1)->ifnone, RHASH(hash2)->ifnone))
+ return Qfalse;
data.tbl = RHASH(hash2)->tbl;
data.result = Qtrue;
diff --git a/lib/cgi.rb b/lib/cgi.rb
index eb476923e..7870c8125 100644
--- a/lib/cgi.rb
+++ b/lib/cgi.rb
@@ -1273,7 +1273,7 @@ The hash keys are case sensitive. Ask the samples.
end
if @output_hidden
hidden = @output_hidden.collect{|k,v|
- "<INPUT TYPE=HIDDEN NAME=\"#{k}\" VALUE=\"#{v}\">"
+ "<DIV><INPUT TYPE=HIDDEN NAME=\"#{k}\" VALUE=\"#{v}\"></DIV>"
}.to_s
body += hidden
end
diff --git a/object.c b/object.c
index 6b6f1b5ab..13ae657ee 100644
--- a/object.c
+++ b/object.c
@@ -684,10 +684,14 @@ static VALUE
rb_class_allocate_instance(klass)
VALUE klass;
{
- NEWOBJ(obj, struct RObject);
- OBJSETUP(obj, klass, T_OBJECT);
-
- return (VALUE)obj;
+ if (rb_frame_last_func() != alloc) {
+ return rb_obj_alloc(klass);
+ }
+ else {
+ NEWOBJ(obj, struct RObject);
+ OBJSETUP(obj, klass, T_OBJECT);
+ return (VALUE)obj;
+ }
}
VALUE
diff --git a/version.h b/version.h
index 622e22f49..3bb7a00b6 100644
--- a/version.h
+++ b/version.h
@@ -1,4 +1,4 @@
#define RUBY_VERSION "1.7.2"
-#define RUBY_RELEASE_DATE "2002-08-11"
+#define RUBY_RELEASE_DATE "2002-08-12"
#define RUBY_VERSION_CODE 172
-#define RUBY_RELEASE_CODE 20020811
+#define RUBY_RELEASE_CODE 20020812