aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--marshal.c17
2 files changed, 12 insertions, 10 deletions
diff --git a/ChangeLog b/ChangeLog
index 7537879ada..931cdc4826 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Sun Jan 18 00:23:55 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * marshal.c (class2path): check anonymous class/module before
+ checking referable, and allow singleton classes.
+
Sat Jan 17 23:58:51 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
* error.c (NameError::Message): new class for lazy evaluation of
diff --git a/marshal.c b/marshal.c
index f1993a643b..a7d8b0abca 100644
--- a/marshal.c
+++ b/marshal.c
@@ -105,8 +105,13 @@ class2path(klass)
VALUE path = rb_class_path(klass);
char *n = RSTRING(path)->ptr;
- if (rb_path2class(n) != klass) {
- rb_raise(rb_eArgError, "%s cannot be referred", n);
+ if (n[0] == '#') {
+ rb_raise(rb_eTypeError, "can't dump anonymous %s %s",
+ (TYPE(klass) == T_CLASS ? "class" : "module"),
+ n);
+ }
+ if (rb_path2class(n) != rb_class_real(klass)) {
+ rb_raise(rb_eTypeError, "%s cannot be referred", n);
}
return path;
}
@@ -531,10 +536,6 @@ w_object(obj, arg, limit)
w_byte(TYPE_CLASS, arg);
{
VALUE path = class2path(obj);
- if (RSTRING(path)->ptr[0] == '#') {
- rb_raise(rb_eTypeError, "can't dump anonymous class %s",
- RSTRING(path)->ptr);
- }
w_bytes(RSTRING(path)->ptr, RSTRING(path)->len, arg);
}
break;
@@ -543,10 +544,6 @@ w_object(obj, arg, limit)
w_byte(TYPE_MODULE, arg);
{
VALUE path = class2path(obj);
- if (RSTRING(path)->ptr[0] == '#') {
- rb_raise(rb_eTypeError, "can't dump anonymous module %s",
- RSTRING(path)->ptr);
- }
w_bytes(RSTRING(path)->ptr, RSTRING(path)->len, arg);
}
break;