mirror of
https://github.com/ruby/ruby.git
synced 2025-09-16 17:14:01 +02:00
merge revision(s) 54934: [Backport #12355]
* process.c (rb_exec_getargs): honor the expected argument types over the conversion method. the basic language functionality should be robust. [ruby-core:75388] [Bug #12355] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@55362 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
5287eb7453
commit
a05bfd4941
4 changed files with 39 additions and 3 deletions
16
process.c
16
process.c
|
@ -2011,13 +2011,25 @@ rb_check_argv(int argc, VALUE *argv)
|
|||
return prog;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
check_hash(VALUE obj)
|
||||
{
|
||||
if (SPECIAL_CONST_P(obj)) return Qnil;
|
||||
switch (BUILTIN_TYPE(obj)) {
|
||||
case T_STRING:
|
||||
case T_ARRAY:
|
||||
return Qnil;
|
||||
}
|
||||
return rb_check_hash_type(obj);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rb_exec_getargs(int *argc_p, VALUE **argv_p, int accept_shell, VALUE *env_ret, VALUE *opthash_ret)
|
||||
{
|
||||
VALUE hash, prog;
|
||||
|
||||
if (0 < *argc_p) {
|
||||
hash = rb_check_hash_type((*argv_p)[*argc_p-1]);
|
||||
hash = check_hash((*argv_p)[*argc_p-1]);
|
||||
if (!NIL_P(hash)) {
|
||||
*opthash_ret = hash;
|
||||
(*argc_p)--;
|
||||
|
@ -2025,7 +2037,7 @@ rb_exec_getargs(int *argc_p, VALUE **argv_p, int accept_shell, VALUE *env_ret, V
|
|||
}
|
||||
|
||||
if (0 < *argc_p) {
|
||||
hash = rb_check_hash_type((*argv_p)[0]);
|
||||
hash = check_hash((*argv_p)[0]);
|
||||
if (!NIL_P(hash)) {
|
||||
*env_ret = hash;
|
||||
(*argc_p)--;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue