ruby-changes:39733
From: usa <ko1@a...>
Date: Wed, 9 Sep 2015 18:19:07 +0900 (JST)
Subject: [ruby-changes:39733] usa:r51814 (trunk): * lib/rubygems/stub_specification.rb (Gem::StubSpecification#data):
usa 2015-09-09 18:18:47 +0900 (Wed, 09 Sep 2015) New Revision: 51814 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=51814 Log: * lib/rubygems/stub_specification.rb (Gem::StubSpecification#data): should not change the value of $. when `require`ing gems. this fixed test failures introduced by r51813. Modified files: trunk/ChangeLog trunk/lib/rubygems/stub_specification.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 51813) +++ ChangeLog (revision 51814) @@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Wed Sep 9 18:16:14 2015 NAKAMURA Usaku <usa@r...> + + * lib/rubygems/stub_specification.rb (Gem::StubSpecification#data): + should not change the value of $. when `require`ing gems. + this fixed test failures introduced by r51813. + Wed Sep 9 16:55:45 2015 NAKAMURA Usaku <usa@r...> * ruby.c (usage, enable_option, disable_option, process_options): new Index: lib/rubygems/stub_specification.rb =================================================================== --- lib/rubygems/stub_specification.rb (revision 51813) +++ lib/rubygems/stub_specification.rb (revision 51814) @@ -73,18 +73,23 @@ class Gem::StubSpecification < Gem::Basi https://github.com/ruby/ruby/blob/trunk/lib/rubygems/stub_specification.rb#L73 unless @data @extensions = [] - open loaded_from, OPEN_MODE do |file| - begin - file.readline # discard encoding line - stubline = file.readline.chomp - if stubline.start_with?(PREFIX) then - @data = StubLine.new stubline + begin + saved_lineno = $. + open loaded_from, OPEN_MODE do |file| + begin + file.readline # discard encoding line + stubline = file.readline.chomp + if stubline.start_with?(PREFIX) then + @data = StubLine.new stubline - @extensions = $'.split "\0" if - /\A#{PREFIX}/ =~ file.readline.chomp + @extensions = $'.split "\0" if + /\A#{PREFIX}/ =~ file.readline.chomp + end + rescue EOFError end - rescue EOFError end + ensure + $. = saved_lineno end end -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/