summaryrefslogtreecommitdiffstats
path: root/marshal.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-04-08 05:40:29 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-04-08 05:40:29 +0000
commit7c6ba274de3deab3dd03fc356b863a69b1828d26 (patch)
treec77a4134845f60587eeaf832e3569ffda3846861 /marshal.c
parentb5c4018402a0fdbb19a67017085f220de218342f (diff)
downloadruby-7c6ba274de3deab3dd03fc356b863a69b1828d26.tar.gz
ruby-7c6ba274de3deab3dd03fc356b863a69b1828d26.tar.xz
ruby-7c6ba274de3deab3dd03fc356b863a69b1828d26.zip
* eval.c (Init_Proc): make Method and UnboundMethod independent.
They are like instance and its class. [ruby-core:00941] * parse.y (yylex): disallow global variables like "$1ve". [ruby-core:00945] * marshal.c (marshal_dump): Marshal.dump(0, false) should cause an error. (ruby-bugs-ja PR#421) * regex.c (re_compile_pattern): warn if '-' is the edge of character range. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@3648 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'marshal.c')
-rw-r--r--marshal.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/marshal.c b/marshal.c
index b023086aa..b8319dcdc 100644
--- a/marshal.c
+++ b/marshal.c
@@ -589,19 +589,22 @@ marshal_dump(argc, argv)
struct dump_arg arg;
struct dump_call_arg c_arg;
- port = 0;
+ port = Qnil;
rb_scan_args(argc, argv, "12", &obj, &a1, &a2);
if (argc == 3) {
if (!NIL_P(a2)) limit = NUM2INT(a2);
+ if (NIL_P(a1)) goto type_error;
port = a1;
}
else if (argc == 2) {
if (FIXNUM_P(a1)) limit = FIX2INT(a1);
+ else if (NIL_P(a1)) goto type_error;
else port = a1;
}
arg.dest = 0;
- if (port) {
+ if (!NIL_P(port)) {
if (!rb_respond_to(port, s_write)) {
+ type_error:
rb_raise(rb_eTypeError, "instance of IO needed");
}
arg.str = rb_str_buf_new(0);