Project

General

Profile

Actions

Bug #16297

closed

calling undefined allocator by `Class.instance_method(:allocate)`

Added by nobu (Nobuyoshi Nakada) over 2 years ago. Updated about 1 year ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Target version:
-
ruby -v:
[ruby-dev:50856]

Description

For instance, Rational.allocate is undefined.

Rational.allocate #=> undefined method `allocate' for Rational:Class (NoMethodError)

But it can be called by Class.instance_method(:allocate).

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.

Updated by usa (Usaku NAKAMURA) about 1 year ago

  • Backport changed from 2.5: REQUIRED, 2.6: REQUIRED to 2.5: REQUIRED, 2.6: DONE

ruby_2_6 r67896 merged revision(s) f72dc407.

Updated by usa (Usaku NAKAMURA) about 1 year ago

usa (Usaku NAKAMURA) wrote in #note-1:

ruby_2_6 r67896 merged revision(s) f72dc407.

note that ruby_2_6 does not have UnboundMethod#bind_call.

Actions

Also available in: Atom PDF