From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: poffice@blade.nagaokaut.ac.jp Delivered-To: poffice@blade.nagaokaut.ac.jp Received: from kankan.nagaokaut.ac.jp (kankan.nagaokaut.ac.jp [133.44.2.24]) by blade.nagaokaut.ac.jp (Postfix) with ESMTP id 302C2196025D for ; Fri, 17 Jul 2015 13:51:54 +0900 (JST) Received: from funfun.nagaokaut.ac.jp (smtp.nagaokaut.ac.jp [133.44.2.201]) by kankan.nagaokaut.ac.jp (Postfix) with ESMTP id 17981B5D994 for ; Fri, 17 Jul 2015 14:20:50 +0900 (JST) Received: from funfun.nagaokaut.ac.jp (localhost.nagaokaut.ac.jp [127.0.0.1]) by funfun.nagaokaut.ac.jp (Postfix) with ESMTP id AE17F97A838 for ; Fri, 17 Jul 2015 14:20:51 +0900 (JST) X-Virus-Scanned: amavisd-new at nagaokaut.ac.jp Authentication-Results: funfun.nagaokaut.ac.jp (amavisd-new); dkim=fail (1024-bit key) reason="fail (message has been altered)" header.d=sendgrid.me Received: from funfun.nagaokaut.ac.jp ([127.0.0.1]) by funfun.nagaokaut.ac.jp (funfun.nagaokaut.ac.jp [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 1YhCzuL3pVj7 for ; Fri, 17 Jul 2015 14:20:51 +0900 (JST) Received: from voscc.nagaokaut.ac.jp (voscc.nagaokaut.ac.jp [133.44.1.100]) by funfun.nagaokaut.ac.jp (Postfix) with ESMTP id 4261897A826 for ; Fri, 17 Jul 2015 14:20:51 +0900 (JST) Received: from neon.ruby-lang.org (neon.ruby-lang.org [221.186.184.75]) by voscc.nagaokaut.ac.jp (Postfix) with ESMTP id EED6C952439 for ; Fri, 17 Jul 2015 14:20:48 +0900 (JST) Received: from [221.186.184.76] (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id 3566C12049B; Fri, 17 Jul 2015 14:20:46 +0900 (JST) X-Original-To: ruby-core@ruby-lang.org Delivered-To: ruby-core@ruby-lang.org Received: from o2.heroku.sendgrid.net (o2.heroku.sendgrid.net [67.228.50.55]) by neon.ruby-lang.org (Postfix) with ESMTPS id 5480512041F for ; Fri, 17 Jul 2015 14:20:42 +0900 (JST) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sendgrid.me; h=from:to:references:subject:mime-version:content-type:content-transfer-encoding:list-id; s=smtpapi; bh=sMl4qT7XKTZbu7ka97Qv/PWjhlk=; b=ClnYtXPA2H+hivhT36 TVlaT2/iFbKX279NbqFyb+aF5DST92doMhduNvRKaBdFfysJHVde4K1x91pDhGZx QUAxQT5dUx1iQgfOu8WXX76JMfvmK62VzEdYP6ZacQA8RqtA9nLuITO/Fl8UP0+r USTnpPcUaHDN0EYkg5WrWJDEQ= Received: by filter0551p1mdw1.sendgrid.net with SMTP id filter0551p1mdw1.24578.55A8909D11 2015-07-17 05:20:34.031006054 +0000 UTC Received: from ismtpd-031.iad1.sendgrid.net ([UNAVAILABLE]. [10.42.2.99]) by 10.42.243.12:2500 (trex/5.2.13); Fri, 17 Jul 2015 05:20:35 GMT Received: from herokuapp.com (ec2-54-145-73-137.compute-1.amazonaws.com [54.145.73.137]) by ismtpd-031 (SG) with ESMTP id 14e9a74f847.5824.c4beb8 for ; Fri, 17 Jul 2015 05:20:33 +0000 (UTC) Date: Fri, 17 Jul 2015 05:20:33 +0000 From: ko1@atdot.net To: ruby-core@ruby-lang.org Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Redmine-MailingListIntegration-Message-Ids: 44623 X-Redmine-Project: ruby-trunk X-Redmine-Issue-Id: 11360 X-Redmine-Issue-Author: ko1 X-Redmine-Issue-Assignee: ko1 X-Redmine-Sender: ko1 X-Mailer: Redmine X-Redmine-Host: bugs.ruby-lang.org X-Redmine-Site: Ruby Issue Tracking System X-Auto-Response-Suppress: All Auto-Submitted: auto-generated X-SG-EID: ync6xU2WACa70kv/Ymy4QrNMhiuLXJG8OTL2vJD1yS76bWQu80MF11sbTM01fz58AFgyRrztj4htKo BTR8Y0X+ifFi/ejYsoa5fvTrZjqRrTfwXcu8hrR+0fIgsn+vl+qyM+7L00YMMFrCnvzPrSc6uPRguk 8oLpZCKMciZmiIejwPMqqQqfJEX4ZIA9kdI9 X-SendGrid-Contentd-ID: {"test_id":"1437110438"} X-ML-Name: ruby-core X-Mail-Count: 70006 Subject: [ruby-core:70006] [Ruby trunk - Bug #11360] [Open] Singleton class doesn't appear by ObjectSpace.each_object X-BeenThere: ruby-core@ruby-lang.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: Ruby developers List-Id: Ruby developers List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: ruby-core-bounces@ruby-lang.org Sender: "ruby-core" Issue #11360 has been reported by Koichi Sasada. ---------------------------------------- Bug #11360: Singleton class doesn't appear by ObjectSpace.each_object https://bugs.ruby-lang.org/issues/11360 * Author: Koichi Sasada * Status: Open * Priority: Normal * Assignee: Koichi Sasada * ruby -v: 2.3dev * Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN ---------------------------------------- Singleton class doesn't appear by ObjectSpace.each_object. The following is reproducible code. ```ruby class C class << self p [self, self.class] $c = self end end ObjectSpace.each_object(Class){|o| exit if $c == o } raise "#{$c} is not found!" ``` This is because internal_object_p in gc.c skips singleton classes. ```C static int internal_object_p(VALUE obj) { RVALUE *p = (RVALUE *)obj; if (p->as.basic.flags) { switch (BUILTIN_TYPE(p)) { case T_NONE: case T_IMEMO: case T_ICLASS: case T_NODE: case T_ZOMBIE: break; case T_CLASS: if (FL_TEST(p, FL_SINGLETON)) break; default: if (!p->as.basic.klass) break; return 0; } } return 1; } ``` -- https://bugs.ruby-lang.org/