Project

General

Profile

Actions

Bug #19833

closed

Superclass of BasicObject is broken.

Added by ksss (Yuki Kurihara) about 1 year ago. Updated about 1 year ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 3.3.0dev (2023-08-08T00:21:45Z master 69292676a2) [arm64-darwin22]
[ruby-core:114356]

Description

I encountered a phenomenon where a non-class object appeared in the superclass of BasicObject.

The minimum reproduction code is below.

module Mod
end

BasicObject.include Mod
# or BasicObject.prepend Mod

p BasicObject.superclass
#=> 2431129 or false

I think it is a practical problem because I found it by running code that monitors singleton_method_added as follows.

https://github.com/ksss/orthoses/blob/341019c78ba625bc5d36c0f359c7d88621990f78/lib/orthoses/lazy_trace_point.rb#L35-L48

Updated by znz (Kazuhiro NISHIYAMA) about 1 year ago

I can reproduce since 3.2.

$ docker run --platform linux/amd64 --rm -it ghcr.io/ruby/all-ruby env LANG=C.UTF-8 ALL_RUBY_SINCE=ruby-1.9 ./all-ruby -e 'class BasicObject; include ::Module.new; p superclass; end'
ruby-1.9.0-0        nil
...
ruby-3.2.0-preview1 nil
ruby-3.2.0-preview2 16
...
ruby-3.3.0-preview1 16

Updated by nobu (Nobuyoshi Nakada) about 1 year ago

  • Backport changed from 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN to 3.0: DONTNEED, 3.1: DONTNEED, 3.2: REQUIRED
Actions #3

Updated by nobu (Nobuyoshi Nakada) about 1 year ago

  • Status changed from Open to Closed

Applied in changeset git|72d1a790cfe0e4a457db98c587f1acaa5e39f001.


[Bug #19833] Fix index underflow at superclasses of BasicObject

Updated by nagachika (Tomoyuki Chikanaga) about 1 year ago

  • Backport changed from 3.0: DONTNEED, 3.1: DONTNEED, 3.2: REQUIRED to 3.0: DONTNEED, 3.1: DONTNEED, 3.2: DONE

ruby_3_2 b11f238a811513b31c4f65c822370ac470f438dc merged revision(s) 72d1a790cfe0e4a457db98c587f1acaa5e39f001.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like1Like0