Issue #12485 has been updated by Kenta Murata.


Nobuyoshi Nakada wrote:
> You can use `RB_INTEGER_TYPE_P` in the trunk.

I forgot it. Thanks.

----------------------------------------
Bug #12485: Kernel.Rational raises TypeError though given denominator returns 1 by to_int
https://bugs.ruby-lang.org/issues/12485#change-59204

* Author: Kenta Murata
* Status: Open
* Priority: Normal
* Assignee: 
* ruby -v: ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-darwin15]
* Backport: 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: UNKNOWN
----------------------------------------
Is it an intentional behavior?

```ruby
class << (o = Object.new)
  def to_int
    1
  end
end

Rational(1, o)  #=> TypeError: not an integer
```

---Files--------------------------------
rational.c.diff (539 Bytes)


-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>