aboutsummaryrefslogtreecommitdiffstats
path: root/error.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-01-26 06:41:13 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-01-26 06:41:13 +0000
commit8126f21cc9838a6a7444945727075c324c54f57b (patch)
tree059ce1b8c8689447543e6d8b076aad315a2d3b2c /error.c
parentb3076dbba15094c3e1ac6ddb203569d8508abfdc (diff)
downloadruby-8126f21cc9838a6a7444945727075c324c54f57b.tar.gz
error.c: KeyError missing keyword arguments
* error.c (key_err_initialize): leave attributes for missing keyword arguments unset, so accessors can tell if it is missing or explicit nil. [Feature #14313] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62053 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'error.c')
-rw-r--r--error.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/error.c b/error.c
index 990f9f7855..7870e58035 100644
--- a/error.c
+++ b/error.c
@@ -1692,8 +1692,6 @@ key_err_initialize(int argc, VALUE *argv, VALUE self)
{
VALUE message;
VALUE options;
- VALUE receiver = Qnil;
- VALUE key = Qnil;
rb_scan_args(argc, argv, "01:", &message, &options);
@@ -1711,16 +1709,13 @@ key_err_initialize(int argc, VALUE *argv, VALUE self)
keywords[1] = id_key;
rb_get_kwargs(options, keywords, 0, 2, values);
if (values[0] != Qundef) {
- receiver = values[0];
+ rb_ivar_set(self, id_receiver, values[0]);
}
if (values[1] != Qundef) {
- key = values[1];
+ rb_ivar_set(self, id_key, values[1]);
}
}
- rb_ivar_set(self, id_receiver, receiver);
- rb_ivar_set(self, id_key, key);
-
return self;
}