Skip to content

Commit 277d1f5

Browse files
committed
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
2 parents 3a4d8ba + e720935 commit 277d1f5

File tree

7 files changed

+54
-20
lines changed

7 files changed

+54
-20
lines changed

ChangeLog

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
Thu Sep 8 17:47:18 2016 Kazuki Tsujimoto <kazuki@callcc.net>
2+
3+
* array.c (flatten): use rb_obj_class instead of rb_class_of
4+
because rb_class_of may return a singleton class.
5+
[ruby-dev:49781] [Bug #12738]
6+
7+
Thu Sep 8 17:40:15 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
8+
9+
* tool/rbinstall.rb (gem): use the bindir of each gemspec instead
10+
of hardcoded 'bin', since rdoc 5.0.0 overrides it.
11+
12+
Thu Sep 8 16:47:03 2016 Shugo Maeda <shugo@ruby-lang.org>
13+
14+
* eval.c (rb_mod_s_used_modules): rename Module.used_refinements to
15+
Module.used_modules. [Feature #7418] [ruby-core:49805]
16+
117
Thu Sep 8 14:21:48 2016 SHIBATA Hiroshi <hsbt@ruby-lang.org>
218

319
* ext/psych/psych.gemspec, lib/rdoc/rdoc.gemspec: Use file list instead of

array.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4583,7 +4583,7 @@ flatten(VALUE ary, int level, int *modified)
45834583

45844584
st_free_table(memo);
45854585

4586-
RBASIC_SET_CLASS(result, rb_class_of(ary));
4586+
RBASIC_SET_CLASS(result, rb_obj_class(ary));
45874587
return result;
45884588
}
45894589

eval.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1312,7 +1312,7 @@ mod_using(VALUE self, VALUE module)
13121312
}
13131313

13141314
static int
1315-
used_refinements_i(VALUE _, VALUE mod, VALUE ary)
1315+
used_modules_i(VALUE _, VALUE mod, VALUE ary)
13161316
{
13171317
ID id_defined_at;
13181318
CONST_ID(id_defined_at, "__defined_at__");
@@ -1325,10 +1325,10 @@ used_refinements_i(VALUE _, VALUE mod, VALUE ary)
13251325

13261326
/*
13271327
* call-seq:
1328-
* used_refinements -> array
1328+
* used_modules -> array
13291329
*
1330-
* Returns an array of all active refinements in the current scope. The
1331-
* ordering of modules in the resulting array is not defined.
1330+
* Returns an array of all modules used in the current scope. The ordering
1331+
* of modules in the resulting array is not defined.
13321332
*
13331333
* module A
13341334
* refine Object do
@@ -1342,21 +1342,21 @@ used_refinements_i(VALUE _, VALUE mod, VALUE ary)
13421342
*
13431343
* using A
13441344
* using B
1345-
* p Module.used_refinements
1345+
* p Module.used_modules
13461346
*
13471347
* <em>produces:</em>
13481348
*
13491349
* [B, A]
13501350
*/
13511351
static VALUE
1352-
rb_mod_s_used_refinements(void)
1352+
rb_mod_s_used_modules(void)
13531353
{
13541354
const rb_cref_t *cref = rb_vm_cref();
13551355
VALUE ary = rb_ary_new();
13561356

13571357
while(cref) {
13581358
if(!NIL_P(CREF_REFINEMENTS(cref))) {
1359-
rb_hash_foreach(CREF_REFINEMENTS(cref), used_refinements_i, ary);
1359+
rb_hash_foreach(CREF_REFINEMENTS(cref), used_modules_i, ary);
13601360
}
13611361
cref = CREF_NEXT(cref);
13621362
}
@@ -1698,8 +1698,8 @@ Init_eval(void)
16981698
rb_define_private_method(rb_cModule, "prepend_features", rb_mod_prepend_features, 1);
16991699
rb_define_private_method(rb_cModule, "refine", rb_mod_refine, 1);
17001700
rb_define_private_method(rb_cModule, "using", mod_using, 1);
1701-
rb_define_singleton_method(rb_cModule, "used_refinements",
1702-
rb_mod_s_used_refinements, 0);
1701+
rb_define_singleton_method(rb_cModule, "used_modules",
1702+
rb_mod_s_used_modules, 0);
17031703
rb_undef_method(rb_cClass, "refine");
17041704

17051705
rb_undef_method(rb_cClass, "module_function");

io.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7716,7 +7716,7 @@ rb_file_initialize(int argc, VALUE *argv, VALUE io)
77167716
rb_raise(rb_eRuntimeError, "reinitializing File");
77177717
}
77187718
if (0 < argc && argc < 3) {
7719-
VALUE fd = rb_check_convert_type(argv[0], T_FIXNUM, "Fixnum", "to_int");
7719+
VALUE fd = rb_check_to_int(argv[0]);
77207720

77217721
if (!NIL_P(fd)) {
77227722
argv[0] = fd;

test/ruby/test_array.rb

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -813,6 +813,15 @@ def test_flatten_splat
813813
assert_nothing_raised(RuntimeError, bug10748) {a.flatten(1)}
814814
end
815815

816+
def test_flattern_singleton_class
817+
bug12738 = '[ruby-dev:49781] [Bug #12738]'
818+
a = [[0]]
819+
class << a
820+
def m; end
821+
end
822+
assert_raise(NoMethodError, bug12738) { a.flatten.m }
823+
end
824+
816825
def test_flatten!
817826
a1 = @cls[ 1, 2, 3]
818827
a2 = @cls[ 5, 6 ]
@@ -850,6 +859,15 @@ def test_flatten_splat!
850859
assert_nothing_raised(RuntimeError, bug10748) {a.flatten!(1)}
851860
end
852861

862+
def test_flattern_singleton_class!
863+
bug12738 = '[ruby-dev:49781] [Bug #12738]'
864+
a = [[0]]
865+
class << a
866+
def m; end
867+
end
868+
assert_nothing_raised(NameError, bug12738) { a.flatten!.m }
869+
end
870+
853871
def test_flatten_with_callcc
854872
need_continuation
855873
o = Object.new

test/ruby/test_refinement.rb

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1651,27 +1651,27 @@ def in_ref_c
16511651

16521652
module Foo
16531653
using RefB
1654-
USED_REFS = Module.used_refinements
1654+
USED_MODS = Module.used_modules
16551655
end
16561656

16571657
module Bar
16581658
using RefC
1659-
USED_REFS = Module.used_refinements
1659+
USED_MODS = Module.used_modules
16601660
end
16611661

16621662
module Combined
16631663
using RefA
16641664
using RefB
1665-
USED_REFS = Module.used_refinements
1665+
USED_MODS = Module.used_modules
16661666
end
16671667
end
16681668

1669-
def test_used_refinements
1669+
def test_used_modules
16701670
ref = VisibleRefinements
1671-
assert_equal [], Module.used_refinements
1672-
assert_equal [ref::RefB], ref::Foo::USED_REFS
1673-
assert_equal [ref::RefC], ref::Bar::USED_REFS
1674-
assert_equal [ref::RefB, ref::RefA], ref::Combined::USED_REFS
1671+
assert_equal [], Module.used_modules
1672+
assert_equal [ref::RefB], ref::Foo::USED_MODS
1673+
assert_equal [ref::RefC], ref::Bar::USED_MODS
1674+
assert_equal [ref::RefB, ref::RefA], ref::Combined::USED_MODS
16751675
end
16761676

16771677
def test_warn_setconst_in_refinmenet

tool/rbinstall.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -727,7 +727,7 @@ class Gem::Installer
727727
end
728728

729729
unless gemspec.executables.empty? then
730-
bin_dir = File.join(gem_dir, 'gems', full_name, 'bin')
730+
bin_dir = File.join(gem_dir, 'gems', full_name, gemspec.bindir)
731731
makedirs(bin_dir)
732732

733733
execs = gemspec.executables.map {|exec| File.join(srcdir, 'bin', exec)}

0 commit comments

Comments
 (0)