* [ruby-dev:50856] [Ruby master Bug#16297] calling undefined allocator by `Class.instance_method(:allocate)`
[not found] <redmine.issue-16297.20191106021600@ruby-lang.org>
@ 2019-11-06 2:16 ` nobu
0 siblings, 0 replies; only message in thread
From: nobu @ 2019-11-06 2:16 UTC (permalink / raw)
To: ruby-dev
Issue #16297 has been reported by nobu (Nobuyoshi Nakada).
----------------------------------------
Bug #16297: calling undefined allocator by `Class.instance_method(:allocate)`
https://bugs.ruby-lang.org/issues/16297
* Author: nobu (Nobuyoshi Nakada)
* Status: Closed
* Priority: Normal
* Assignee:
* Target version:
* ruby -v:
* Backport: 2.5: REQUIRED, 2.6: REQUIRED
----------------------------------------
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/
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2019-11-06 2:16 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <redmine.issue-16297.20191106021600@ruby-lang.org>
2019-11-06 2:16 ` [ruby-dev:50856] [Ruby master Bug#16297] calling undefined allocator by `Class.instance_method(:allocate)` nobu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).