ruby-dev (Japanese) list archive (unofficial mirror)
 help / color / mirror / Atom feed
* [ruby-dev:51027] [Ruby master Bug#16297] calling undefined allocator by `Class.instance_method(:allocate)`
       [not found] <redmine.issue-16297.20191106021600.4@ruby-lang.org>
@ 2021-02-28 14:02 ` usa
  2021-02-28 14:06 ` [ruby-dev:51028] " usa
  2024-03-01  0:38 ` [ruby-dev:52076] " jhawthorn (John Hawthorn) via ruby-dev
  2 siblings, 0 replies; 3+ messages in thread
From: usa @ 2021-02-28 14:02 UTC (permalink / raw)
  To: ruby-dev

Issue #16297 has been updated by usa (Usaku NAKAMURA).

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

ruby_2_6 r67896 merged revision(s) f72dc407.

----------------------------------------
Bug #16297: calling undefined allocator by `Class.instance_method(:allocate)`
https://bugs.ruby-lang.org/issues/16297#change-90649

* Author: nobu (Nobuyoshi Nakada)
* Status: Closed
* Priority: Normal
* 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/

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [ruby-dev:51028] [Ruby master Bug#16297] calling undefined allocator by `Class.instance_method(:allocate)`
       [not found] <redmine.issue-16297.20191106021600.4@ruby-lang.org>
  2021-02-28 14:02 ` [ruby-dev:51027] [Ruby master Bug#16297] calling undefined allocator by `Class.instance_method(:allocate)` usa
@ 2021-02-28 14:06 ` usa
  2024-03-01  0:38 ` [ruby-dev:52076] " jhawthorn (John Hawthorn) via ruby-dev
  2 siblings, 0 replies; 3+ messages in thread
From: usa @ 2021-02-28 14:06 UTC (permalink / raw)
  To: ruby-dev

Issue #16297 has been updated by usa (Usaku NAKAMURA).


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`.

----------------------------------------
Bug #16297: calling undefined allocator by `Class.instance_method(:allocate)`
https://bugs.ruby-lang.org/issues/16297#change-90650

* Author: nobu (Nobuyoshi Nakada)
* Status: Closed
* Priority: Normal
* 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/

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [ruby-dev:52076]  [Ruby master Bug#16297] calling undefined allocator by `Class.instance_method(:allocate)`
       [not found] <redmine.issue-16297.20191106021600.4@ruby-lang.org>
  2021-02-28 14:02 ` [ruby-dev:51027] [Ruby master Bug#16297] calling undefined allocator by `Class.instance_method(:allocate)` usa
  2021-02-28 14:06 ` [ruby-dev:51028] " usa
@ 2024-03-01  0:38 ` jhawthorn (John Hawthorn) via ruby-dev
  2 siblings, 0 replies; 3+ messages in thread
From: jhawthorn (John Hawthorn) via ruby-dev @ 2024-03-01  0:38 UTC (permalink / raw)
  To: ruby-dev; +Cc: jhawthorn (John Hawthorn)

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/

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-03-01  0:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <redmine.issue-16297.20191106021600.4@ruby-lang.org>
2021-02-28 14:02 ` [ruby-dev:51027] [Ruby master Bug#16297] calling undefined allocator by `Class.instance_method(:allocate)` usa
2021-02-28 14:06 ` [ruby-dev:51028] " usa
2024-03-01  0:38 ` [ruby-dev:52076] " jhawthorn (John Hawthorn) via ruby-dev

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).