[前][次][番号順一覧][スレッド一覧]

ruby-changes:57022

From: Nobuyoshi <ko1@a...>
Date: Wed, 14 Aug 2019 11:27:32 +0900 (JST)
Subject: [ruby-changes:57022] Nobuyoshi Nakada: 8b44307894 (master): [ruby/stringio] Allow bignum mode

https://git.ruby-lang.org/ruby.git/commit/?id=8b44307894

From 8b44307894c3da6219e14693dc355ebb702310e0 Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Wed, 14 Aug 2019 10:42:14 +0900
Subject: [ruby/stringio] Allow bignum mode

https://github.com/ruby/stringio/commit/d28927b561

diff --git a/ext/stringio/stringio.c b/ext/stringio/stringio.c
index 24d5b81..284a256 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, https://github.com/ruby/ruby/blob/trunk/ext/stringio/stringio.c#L33
 		      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 {
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]