mirror of
https://github.com/ruby/ruby.git
synced 2025-09-15 16:44:01 +02:00
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 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_0_0@40294 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
5525ff192c
commit
c6c33ec6ff
4 changed files with 23 additions and 2 deletions
|
@ -1,3 +1,9 @@
|
|||
Mon Apr 15 00:15:04 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* 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@ruby-lang.org>
|
||||
|
||||
* win32/file.c (code_page): use cp1252 instead of cp20127 as US-ASCII.
|
||||
|
|
10
class.c
10
class.c
|
@ -307,6 +307,14 @@ rb_singleton_class_attached(VALUE klass, VALUE obj)
|
|||
*/
|
||||
#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, VALUE obj)
|
|||
* @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))
|
||||
|
||||
|
||||
/*!
|
||||
|
|
|
@ -215,6 +215,13 @@ class TestEval < Test::Unit::TestCase
|
|||
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
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue