mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
class.c: fix option hash
* class.c (rb_scan_args): if no keywords is given return nil as the option hash. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44244 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
5515c5642e
commit
c5601931c2
2 changed files with 4 additions and 1 deletions
2
class.c
2
class.c
|
@ -1788,7 +1788,7 @@ rb_scan_args(int argc, const VALUE *argv, const char *fmt, ...)
|
|||
if (!NIL_P(hash)) {
|
||||
VALUE opts = rb_extract_keywords(&hash);
|
||||
if (!hash) argc--;
|
||||
hash = opts;
|
||||
hash = opts ? opts : Qnil;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2981,6 +2981,9 @@ End
|
|||
File.unlink(path)
|
||||
IO.write(path, "foo", encoding: Encoding::UTF_32BE)
|
||||
assert_equal("\0\0\0f\0\0\0o\0\0\0o", File.binread(path))
|
||||
assert_raise(TypeError) {
|
||||
IO.write(path, "foo", Object.new => Object.new)
|
||||
}
|
||||
ensure
|
||||
t.close!
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue