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 B73AD196025D for ; Fri, 17 Jul 2015 14:17:09 +0900 (JST) Received: from funfun.nagaokaut.ac.jp (funfun.nagaokaut.ac.jp [133.44.2.201]) by kankan.nagaokaut.ac.jp (Postfix) with ESMTP id C699FB5D8F4 for ; Fri, 17 Jul 2015 14:46:05 +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 760D297A827 for ; Fri, 17 Jul 2015 14:46:07 +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 EMvgRTccICV2 for ; Fri, 17 Jul 2015 14:46:07 +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 0A94B97A826 for ; Fri, 17 Jul 2015 14:46:07 +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 1932895243A for ; Fri, 17 Jul 2015 14:46:04 +0900 (JST) Received: from [221.186.184.76] (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id 1E7CE1204A1; Fri, 17 Jul 2015 14:46:03 +0900 (JST) X-Original-To: ruby-core@ruby-lang.org Delivered-To: ruby-core@ruby-lang.org Received: from o10.shared.sendgrid.net (o10.shared.sendgrid.net [173.193.132.135]) by neon.ruby-lang.org (Postfix) with ESMTPS id E67AB120470 for ; Fri, 17 Jul 2015 14:45:59 +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=CtUrkaInnaK+K90Fy0jAtTJqui0=; b=sivV4fMtscAFeOoanS rZ/aixQno/gbB7+d1uVfrun/2J6d4GBeuTESlx89Xjzido18M/mz91edMP0gvQXd 4ogI6aLg00ElOQMQRN1fYfdqdxwnLay0F0M748gp93NYWIbWrPleXYNokhSdrcL/ WMt93CteH5xnPcaGdyG37i/Ys= Received: by filter0559p1mdw1.sendgrid.net with SMTP id filter0559p1mdw1.19420.55A8969113 2015-07-17 05:45:54.218251783 +0000 UTC Received: from ismtpd-014.iad1.sendgrid.net ([UNAVAILABLE]. [10.42.2.119]) by 10.42.243.103:2500 (trex/5.2.14); Fri, 17 Jul 2015 05:45:55 GMT Received: from herokuapp.com (ec2-54-205-60-94.compute-1.amazonaws.com [54.205.60.94]) by ismtpd-014 (SG) with ESMTP id 14e9a8c2acc.3925.e8882f for ; Fri, 17 Jul 2015 05:45:54 +0000 (UTC) Date: Fri, 17 Jul 2015 05:45:54 +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: 44624 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/Ymy4QrNMhiuLXJG8OTL2vJD1yS7Fu1xOvleRbV0sKP71rDvkcz41W9nPqxgxtG o5SaSTn//GCCJfpk3tEsAixPlbtiZpzfqbVRmI9shNhzAqn5YlG25dP0Tc8+BqfG3k+T9mWmya3eTr FO+dxpgEA+8ei8NjbgDftj5E0evpU2GCae2+ X-ML-Name: ruby-core X-Mail-Count: 70007 Subject: [ruby-core:70007] [Ruby trunk - Bug #11360] 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 updated by Koichi Sasada. >From Ruby 1.6, singleton classes are not appeared. Is it intentional? ---------------------------------------- Bug #11360: Singleton class doesn't appear by ObjectSpace.each_object https://bugs.ruby-lang.org/issues/11360#change-53441 * 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/