From: Aaron Patterson Date: 2012-08-14T06:31:05+09:00 Subject: [ruby-core:47165] Re: [ruby-trunk - Bug #6849][Open] Psych.load_file throws TypeError for empty file --IJpNTDwzlM2Ie8A6 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Aug 14, 2012 at 03:12:58AM +0900, Zachary Scott wrote: > On ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-linux] >=20 > I can reproduce this using Psych.load_file. >=20 > However, when I try Psych#load as the implementation suggests[1] > leaving out the utf stuff "bom|utf-8"; it returns false: >=20 > $irb > require 'psych' > `touch empty.yml` > File.open('empty.yml', 'r') { |f| Psych.load(f,'empty file') } > #=3D> false >=20 > Something is up with the File.open mode used by psych: >=20 > $irb > `touch empty.file` > File.open('empty.file', 'r:bom|utf-8') { |f| puts f } > TypeError: no implicit conversion from nil to integer Ah, this is a bug in Ruby: https://bugs.ruby-lang.org/issues/6487 It should be fixed in the next 1.9.3 patch release. --=20 Aaron Patterson http://tenderlovemaking.com/ --IJpNTDwzlM2Ie8A6 Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (Darwin) iQEcBAEBAgAGBQJQKXIPAAoJEJUxcLy0/6/GEOkH/RaRmPMgTn74rYMxG34Xzw5i EB7sYRCbF+NrqswTev3YP3mVSY13O/EOOvS5M/SSX6G1ss3mLHqeaN4Yeq8rhZEj KUwSOfYiCVeXfRxckCY3qFdN1p4kwgbWOeA8iNmTjbjkDgyCJgLuOpwZrFoAh8La AzGYWMEeErOv2pEN1yteuH5hpjewXDSXTTFkpFXr2PFcOaKzODzQCTrpyQMQyzxc cyLVhpjQFfDkF82qoZin/z+4nfwgw2NcZB2gfxcif1E6G5BUYd5jRVuJWIKSUi57 0gwf7onsv2nRLwWRFoju5+jSbMOBsqWh07AyeAsWm2sw8mf0zZ/AGmg2w6zuQtk= =x5ha -----END PGP SIGNATURE----- --IJpNTDwzlM2Ie8A6--