Issue #16297 has been updated by jhawthorn (John Hawthorn).
I'm not sure if there's a deeper problem this causes, but it is still possible
after this patch to call the allocator on a Rational through defining an arbitrary
`allocate` method.
``` ruby
> def Rational.allocate; end
=> :allocate
>
Class.instance_method(:allocate).bind_call(Rational)
=> (0/1)
```
----------------------------------------
Bug #16297: calling undefined allocator by `Class.instance_method(:allocate)`
https://bugs.ruby-lang.org/issues/16297#change-107083
* Author: nobu (Nobuyoshi Nakada)
* Status: Closed
* Backport: 2.5: REQUIRED, 2.6: DONE
----------------------------------------
For instance, `Rational.allocate` is undefined.
```ruby
Rational.allocate #=> undefined method `allocate' for Rational:Class
(NoMethodError)
```
But it can be called by `Class.instance_method(:allocate)`.
```ruby
Class.instance_method(:allocate).bind_call(Rational) #=> (0/1)
Class.instance_method(:allocate).bind(Rational).call #=> (0/1)
```
These allocators are defined for Marshal, and undefined as methods.
--
https://bugs.ruby-lang.org/