[前][次][番号順一覧][スレッド一覧]

ruby-changes:21727

From: tenderlove <ko1@a...>
Date: Thu, 17 Nov 2011 10:38:28 +0900 (JST)
Subject: [ruby-changes:21727] tenderlove:r33775 (trunk): * ext/psych/lib/psych.rb (load_file): make sure opened yaml files are

tenderlove	2011-11-17 10:38:16 +0900 (Thu, 17 Nov 2011)

  New Revision: 33775

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=33775

  Log:
    * ext/psych/lib/psych.rb (load_file): make sure opened yaml files are
      also closed. [ruby-core:41088]

  Modified files:
    trunk/ChangeLog
    trunk/ext/psych/lib/psych.rb

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 33774)
+++ ChangeLog	(revision 33775)
@@ -1,3 +1,8 @@
+Thu Nov 17 10:36:46 2011  Aaron Patterson <aaron@t...>
+
+	* ext/psych/lib/psych.rb (load_file): make sure opened yaml files are
+	  also closed. [ruby-core:41088]
+
 Wed Nov 16 18:13:52 2011  Nobuyoshi Nakada  <nobu@r...>
 
 	* Makefile.in (LIBRUBY_A): check if generated linked library is
Index: ext/psych/lib/psych.rb
===================================================================
--- ext/psych/lib/psych.rb	(revision 33774)
+++ ext/psych/lib/psych.rb	(revision 33775)
@@ -229,7 +229,7 @@
   # Load the document contained in +filename+.  Returns the yaml contained in
   # +filename+ as a ruby object
   def self.load_file filename
-    self.load File.open(filename)
+    File.open(filename) { |f| self.load f }
   end
 
   # :stopdoc:

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]