summaryrefslogtreecommitdiff
path: root/marshal.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2001-06-05 07:19:39 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2001-06-05 07:19:39 +0000
commitd6c60dbf6d42f411a31a1c2e768a5a986a270a8c (patch)
treee8848119511789017b7c0dbf29f8cd37376737e5 /marshal.c
parent21524a3fc00d0e894d0ca0b8fcb7d9c7413c5917 (diff)
* variable.c (rb_mod_const_at): use hash table as internal
data. [new] * variable.c (rb_mod_const_of): ditto. * variable.c (rb_const_list): new function to convert internal data (hash table) to array of strings. * eval.c (rb_mod_s_constants): data handling scheme has changed. * eval.c (rb_add_method): should not call rb_secure(), for last_func may not be set. * io.c (rb_io_ctl): ioctl should accept any integer within C long range. * marshal.c (r_object): wrong type check for modules. * marshal.c (w_object): should not dump anonymous classes/modules. * io.c (rb_open_file): use rb_file_sysopen_internal() if the 3rd argument (permission flags) is given. [new, should be backported?] * io.c (rb_io_mode_binmode): mode string (e.g. "r+") to flags to open(2). * eval.c (rb_eval): NODE_REXPAND expand an array of 1 element as the element itself. [new, should be backported?] * parse.y (ret_args): should treat "*[a]" in rhs expression as "a", not "[a]". * regex.c (re_compile_pattern): should push option modifier at the right place. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1504 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'marshal.c')
-rw-r--r--marshal.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/marshal.c b/marshal.c
index 8bb8d2c984..29620125dd 100644
--- a/marshal.c
+++ b/marshal.c
@@ -52,7 +52,7 @@ shortlen(len, ds)
#endif
#define MARSHAL_MAJOR 4
-#define MARSHAL_MINOR 5
+#define MARSHAL_MINOR 6
#define TYPE_NIL '0'
#define TYPE_TRUE 'T'
@@ -348,6 +348,10 @@ w_object(obj, arg, limit)
w_byte(TYPE_CLASS, arg);
{
VALUE path = rb_class_path(obj);
+ if (RSTRING(path)->ptr[0] == '#') {
+ rb_raise(rb_eArgError, "can't dump anonymous class %s",
+ RSTRING(path)->ptr);
+ }
w_bytes(RSTRING(path)->ptr, RSTRING(path)->len, arg);
}
break;
@@ -356,6 +360,10 @@ w_object(obj, arg, limit)
w_byte(TYPE_MODULE, arg);
{
VALUE path = rb_class_path(obj);
+ if (RSTRING(path)->ptr[0] == '#') {
+ rb_raise(rb_eArgError, "can't dump anonymous module %s",
+ RSTRING(path)->ptr);
+ }
w_bytes(RSTRING(path)->ptr, RSTRING(path)->len, arg);
}
break;
@@ -991,7 +999,7 @@ r_object(arg)
char *buf;
r_bytes(buf, arg);
m = rb_path2class(buf);
- if (TYPE(m) != T_CLASS) {
+ if (TYPE(m) != T_MODULE) {
rb_raise(rb_eTypeError, "%s is not a module", buf);
}
return r_regist(m, arg);