ruby-changes:28242
From: nagachika <ko1@a...>
Date: Mon, 15 Apr 2013 00:17:55 +0900 (JST)
Subject: [ruby-changes:28242] nagachika:r40294 (ruby_2_0_0): merge revision(s) 40013,40032: [Backport #8188]
nagachika 2013-04-15 00:17:44 +0900 (Mon, 15 Apr 2013) New Revision: 40294 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=40294 Log: merge revision(s) 40013,40032: [Backport #8188] * class.c (HAVE_METACLASS_P): should check FL_SINGLTON flag before get instance variable to get rid of wrong warning about __attached__. [ruby-core:53839] [Bug #8188] * class.c (HAVE_METACLASS_P): should check FL_SINGLETON flag before get Modified directories: branches/ruby_2_0_0/ Modified files: branches/ruby_2_0_0/ChangeLog branches/ruby_2_0_0/class.c branches/ruby_2_0_0/test/ruby/test_eval.rb branches/ruby_2_0_0/version.h Index: ruby_2_0_0/ChangeLog =================================================================== --- ruby_2_0_0/ChangeLog (revision 40293) +++ ruby_2_0_0/ChangeLog (revision 40294) @@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/ChangeLog#L1 +Mon Apr 15 00:15:04 2013 Nobuyoshi Nakada <nobu@r...> + + * class.c (HAVE_METACLASS_P): should check FL_SINGLETON flag before get + instance variable to get rid of wrong warning about __attached__. + [ruby-core:53839] [Bug #8188] + Mon Apr 15 00:13:13 2013 NAKAMURA Usaku <usa@r...> * win32/file.c (code_page): use cp1252 instead of cp20127 as US-ASCII. Index: ruby_2_0_0/class.c =================================================================== --- ruby_2_0_0/class.c (revision 40293) +++ ruby_2_0_0/class.c (revision 40294) @@ -307,6 +307,14 @@ rb_singleton_class_attached(VALUE klass, https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/class.c#L307 */ #define META_CLASS_OF_CLASS_CLASS_P(k) (METACLASS_OF(k) == (k)) +/*! + * whether k has a metaclass + * @retval 1 if \a k has a metaclass + * @retval 0 otherwise + */ +#define HAVE_METACLASS_P(k) \ + (FL_TEST(METACLASS_OF(k), FL_SINGLETON) && \ + rb_ivar_get(METACLASS_OF(k), id_attached) == (k)) /*! * ensures \a klass belongs to its own eigenclass. @@ -316,7 +324,7 @@ rb_singleton_class_attached(VALUE klass, https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/class.c#L324 * @note this macro creates a new eigenclass if necessary. */ #define ENSURE_EIGENCLASS(klass) \ - (rb_ivar_get(METACLASS_OF(klass), id_attached) == (klass) ? METACLASS_OF(klass) : make_metaclass(klass)) + (HAVE_METACLASS_P(klass) ? METACLASS_OF(klass) : make_metaclass(klass)) /*! Index: ruby_2_0_0/version.h =================================================================== --- ruby_2_0_0/version.h (revision 40293) +++ ruby_2_0_0/version.h (revision 40294) @@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/version.h#L1 #define RUBY_VERSION "2.0.0" #define RUBY_RELEASE_DATE "2013-04-15" -#define RUBY_PATCHLEVEL 129 +#define RUBY_PATCHLEVEL 130 #define RUBY_RELEASE_YEAR 2013 #define RUBY_RELEASE_MONTH 4 Index: ruby_2_0_0/test/ruby/test_eval.rb =================================================================== --- ruby_2_0_0/test/ruby/test_eval.rb (revision 40293) +++ ruby_2_0_0/test/ruby/test_eval.rb (revision 40294) @@ -215,6 +215,13 @@ class TestEval < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/test/ruby/test_eval.rb#L215 end end + def test_instance_eval_on_argf_singleton_class + bug8188 = '[ruby-core:53839] [Bug #8188]' + assert_warning('', bug8188) do + ARGF.singleton_class.instance_eval{} + end + end + class Foo Bar = 2 end Property changes on: ruby_2_0_0 ___________________________________________________________________ Modified: svn:mergeinfo Merged /trunk:r40013,40032 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/