Skip to content

Commit d28927b

Browse files
committed
Allow bignum mode
1 parent 359c9f3 commit d28927b

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

ext/stringio/stringio.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,15 @@ strio_extract_modeenc(VALUE *vmode_p, VALUE *vperm_p, VALUE opthash,
3333
int *oflags_p, int *fmode_p, struct rb_io_enc_t *convconfig_p)
3434
{
3535
VALUE mode = *vmode_p;
36+
VALUE intmode;
3637
int fmode;
3738

3839
convconfig_p->enc = convconfig_p->enc2 = 0;
3940
if (NIL_P(mode)) {
4041
fmode = FMODE_READABLE;
4142
}
42-
else if (FIXNUM_P(mode)) {
43-
int flags = FIX2INT(mode);
43+
else if (!NIL_P(intmode = rb_check_to_integer(mode, "to_int"))) {
44+
int flags = NUM2INT(intmode);
4445
fmode = rb_io_oflags_fmode(flags);
4546
}
4647
else {

0 commit comments

Comments
 (0)