diff options
author | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-09-09 00:20:57 +0000 |
---|---|---|
committer | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-09-09 00:20:57 +0000 |
commit | 277d1f50bb04b9c8f84311ba8de6568dd3347e36 (patch) | |
tree | 58747bfd08ca61188310e19ea749ff45669d3de0 | |
parent | 3a4d8ba95f65f258674819bf0a6f86238ee853e2 (diff) | |
parent | e7209358b946493310abc3c4178b945b26b80bcf (diff) |
add tag v2_4_0_preview2
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/tags/v2_4_0_preview2@56114 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 16 | ||||
-rw-r--r-- | array.c | 2 | ||||
-rw-r--r-- | eval.c | 18 | ||||
-rw-r--r-- | io.c | 2 | ||||
-rw-r--r-- | test/ruby/test_array.rb | 18 | ||||
-rw-r--r-- | test/ruby/test_refinement.rb | 16 | ||||
-rwxr-xr-x | tool/rbinstall.rb | 2 |
7 files changed, 54 insertions, 20 deletions
@@ -1,3 +1,19 @@ +Thu Sep 8 17:47:18 2016 Kazuki Tsujimoto <kazuki@callcc.net> + + * array.c (flatten): use rb_obj_class instead of rb_class_of + because rb_class_of may return a singleton class. + [ruby-dev:49781] [Bug #12738] + +Thu Sep 8 17:40:15 2016 Nobuyoshi Nakada <nobu@ruby-lang.org> + + * tool/rbinstall.rb (gem): use the bindir of each gemspec instead + of hardcoded 'bin', since rdoc 5.0.0 overrides it. + +Thu Sep 8 16:47:03 2016 Shugo Maeda <shugo@ruby-lang.org> + + * eval.c (rb_mod_s_used_modules): rename Module.used_refinements to + Module.used_modules. [Feature #7418] [ruby-core:49805] + Thu Sep 8 14:21:48 2016 SHIBATA Hiroshi <hsbt@ruby-lang.org> * ext/psych/psych.gemspec, lib/rdoc/rdoc.gemspec: Use file list instead of @@ -4583,7 +4583,7 @@ flatten(VALUE ary, int level, int *modified) st_free_table(memo); - RBASIC_SET_CLASS(result, rb_class_of(ary)); + RBASIC_SET_CLASS(result, rb_obj_class(ary)); return result; } @@ -1312,7 +1312,7 @@ mod_using(VALUE self, VALUE module) } static int -used_refinements_i(VALUE _, VALUE mod, VALUE ary) +used_modules_i(VALUE _, VALUE mod, VALUE ary) { ID id_defined_at; CONST_ID(id_defined_at, "__defined_at__"); @@ -1325,10 +1325,10 @@ used_refinements_i(VALUE _, VALUE mod, VALUE ary) /* * call-seq: - * used_refinements -> array + * used_modules -> array * - * Returns an array of all active refinements in the current scope. The - * ordering of modules in the resulting array is not defined. + * Returns an array of all modules used in the current scope. The ordering + * of modules in the resulting array is not defined. * * module A * refine Object do @@ -1342,21 +1342,21 @@ used_refinements_i(VALUE _, VALUE mod, VALUE ary) * * using A * using B - * p Module.used_refinements + * p Module.used_modules * * <em>produces:</em> * * [B, A] */ static VALUE -rb_mod_s_used_refinements(void) +rb_mod_s_used_modules(void) { const rb_cref_t *cref = rb_vm_cref(); VALUE ary = rb_ary_new(); while(cref) { if(!NIL_P(CREF_REFINEMENTS(cref))) { - rb_hash_foreach(CREF_REFINEMENTS(cref), used_refinements_i, ary); + rb_hash_foreach(CREF_REFINEMENTS(cref), used_modules_i, ary); } cref = CREF_NEXT(cref); } @@ -1698,8 +1698,8 @@ Init_eval(void) rb_define_private_method(rb_cModule, "prepend_features", rb_mod_prepend_features, 1); rb_define_private_method(rb_cModule, "refine", rb_mod_refine, 1); rb_define_private_method(rb_cModule, "using", mod_using, 1); - rb_define_singleton_method(rb_cModule, "used_refinements", - rb_mod_s_used_refinements, 0); + rb_define_singleton_method(rb_cModule, "used_modules", + rb_mod_s_used_modules, 0); rb_undef_method(rb_cClass, "refine"); rb_undef_method(rb_cClass, "module_function"); @@ -7716,7 +7716,7 @@ rb_file_initialize(int argc, VALUE *argv, VALUE io) rb_raise(rb_eRuntimeError, "reinitializing File"); } if (0 < argc && argc < 3) { - VALUE fd = rb_check_convert_type(argv[0], T_FIXNUM, "Fixnum", "to_int"); + VALUE fd = rb_check_to_int(argv[0]); if (!NIL_P(fd)) { argv[0] = fd; diff --git a/test/ruby/test_array.rb b/test/ruby/test_array.rb index addce0d9ba..a19e22aab4 100644 --- a/test/ruby/test_array.rb +++ b/test/ruby/test_array.rb @@ -813,6 +813,15 @@ class TestArray < Test::Unit::TestCase assert_nothing_raised(RuntimeError, bug10748) {a.flatten(1)} end + def test_flattern_singleton_class + bug12738 = '[ruby-dev:49781] [Bug #12738]' + a = [[0]] + class << a + def m; end + end + assert_raise(NoMethodError, bug12738) { a.flatten.m } + end + def test_flatten! a1 = @cls[ 1, 2, 3] a2 = @cls[ 5, 6 ] @@ -850,6 +859,15 @@ class TestArray < Test::Unit::TestCase assert_nothing_raised(RuntimeError, bug10748) {a.flatten!(1)} end + def test_flattern_singleton_class! + bug12738 = '[ruby-dev:49781] [Bug #12738]' + a = [[0]] + class << a + def m; end + end + assert_nothing_raised(NameError, bug12738) { a.flatten!.m } + end + def test_flatten_with_callcc need_continuation o = Object.new diff --git a/test/ruby/test_refinement.rb b/test/ruby/test_refinement.rb index 5980280235..c3c2dbc61f 100644 --- a/test/ruby/test_refinement.rb +++ b/test/ruby/test_refinement.rb @@ -1651,27 +1651,27 @@ class TestRefinement < Test::Unit::TestCase module Foo using RefB - USED_REFS = Module.used_refinements + USED_MODS = Module.used_modules end module Bar using RefC - USED_REFS = Module.used_refinements + USED_MODS = Module.used_modules end module Combined using RefA using RefB - USED_REFS = Module.used_refinements + USED_MODS = Module.used_modules end end - def test_used_refinements + def test_used_modules ref = VisibleRefinements - assert_equal [], Module.used_refinements - assert_equal [ref::RefB], ref::Foo::USED_REFS - assert_equal [ref::RefC], ref::Bar::USED_REFS - assert_equal [ref::RefB, ref::RefA], ref::Combined::USED_REFS + assert_equal [], Module.used_modules + assert_equal [ref::RefB], ref::Foo::USED_MODS + assert_equal [ref::RefC], ref::Bar::USED_MODS + assert_equal [ref::RefB, ref::RefA], ref::Combined::USED_MODS end def test_warn_setconst_in_refinmenet diff --git a/tool/rbinstall.rb b/tool/rbinstall.rb index ab61a0256e..a012d840f5 100755 --- a/tool/rbinstall.rb +++ b/tool/rbinstall.rb @@ -727,7 +727,7 @@ install?(:ext, :comm, :gem) do end unless gemspec.executables.empty? then - bin_dir = File.join(gem_dir, 'gems', full_name, 'bin') + bin_dir = File.join(gem_dir, 'gems', full_name, gemspec.bindir) makedirs(bin_dir) execs = gemspec.executables.map {|exec| File.join(srcdir, 'bin', exec)} |