diff options
author | Nobuyoshi Nakada <[email protected]> | 2019-08-14 10:42:14 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <[email protected]> | 2019-08-14 11:20:58 +0900 |
commit | 8b44307894c3da6219e14693dc355ebb702310e0 (patch) | |
tree | 752ad639afa782e147baae18976bf468e952282b /ext/stringio | |
parent | e54d349a01043082169a88a2782e6739bdd52c4f (diff) |
[ruby/stringio] Allow bignum mode
https://github.com/ruby/stringio/commit/d28927b561
Diffstat (limited to 'ext/stringio')
-rw-r--r-- | ext/stringio/stringio.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/ext/stringio/stringio.c b/ext/stringio/stringio.c index 24d5b81a6b..284a256cbd 100644 --- a/ext/stringio/stringio.c +++ b/ext/stringio/stringio.c @@ -33,14 +33,15 @@ strio_extract_modeenc(VALUE *vmode_p, VALUE *vperm_p, VALUE opthash, int *oflags_p, int *fmode_p, struct rb_io_enc_t *convconfig_p) { VALUE mode = *vmode_p; + VALUE intmode; int fmode; convconfig_p->enc = convconfig_p->enc2 = 0; if (NIL_P(mode)) { fmode = FMODE_READABLE; } - else if (FIXNUM_P(mode)) { - int flags = FIX2INT(mode); + else if (!NIL_P(intmode = rb_check_to_integer(mode, "to_int"))) { + int flags = NUM2INT(intmode); fmode = rb_io_oflags_fmode(flags); } else { |