From: nobu@... Date: 2019-11-06T02:16:01+00:00 Subject: [ruby-dev:50856] [Ruby master Bug#16297] calling undefined allocator by `Class.instance_method(:allocate)` 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/