--7iMSBzlTiPOCCT2k
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Sat, May 12, 2012 at 04:55:08AM +0900, trans (Thomas Sawyer) wrote:
>=20
> Issue #6425 has been reported by trans (Thomas Sawyer).
>=20
> ----------------------------------------
> Bug #6425: Psych issue with !!omap
> https://bugs.ruby-lang.org/issues/6425
>=20
> Author: trans (Thomas Sawyer)
> Status: Open
> Priority: Normal
> Assignee:=20
> Category: lib
> Target version:=20
> ruby -v: ruby 1.9.3p125 (2012-02-16 revision 34643) [x86_64-linux]
>=20
>=20
> =3Dbegin
>=20
> Psych doesn't seem to know ordered map. It parses fine, but loose the typ=
e when round-tripped.
>=20
>   a =3D YAML.load %{
>     --- !!omap
>     a: 1
>     b: 2
>   }
>   =3D> {"a"=3D>1, "b"=3D>2}
>   a.class
>   =3D> Hash
>   puts a.to_yaml
>   ---
>   a: 1
>   b: 2
>=20
> =3Dend

Are you sure this is Psych and not Syck?  Psych raises a syntax error on
your example:

    irb(main):001:0> require 'psych'
    =3D> true
    irb(main):002:0> require 'yaml'
    =3D> true
    irb(main):003:0> a =3D YAML.load %{
    irb(main):004:0"   --- !!omap
    irb(main):005:0"   a: 1
    irb(main):006:0"   b: 2
    irb(main):007:0" }
    Psych::SyntaxError: (<unknown>): mapping values are not allowed in this=
 context at line 3 column 4
            from /Users/aaron/.local/lib/ruby/2.0.0/psych.rb:203:in `parse'
            from /Users/aaron/.local/lib/ruby/2.0.0/psych.rb:203:in `parse_=
stream'
            from /Users/aaron/.local/lib/ruby/2.0.0/psych.rb:151:in `parse'
            from /Users/aaron/.local/lib/ruby/2.0.0/psych.rb:127:in `load'
            from (irb):3
            from /Users/aaron/.local/bin/irb:12:in `<main>'
    irb(main):008:0>

Can you provide a runnable test case to reproduce your error?

--=20
Aaron Patterson
http://tenderlovemaking.com/

--7iMSBzlTiPOCCT2k
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (Darwin)

iQEcBAEBAgAGBQJPsEepAAoJEJUxcLy0/6/GQi4IAJhxOM3goyii/hWbpCJOqMcw
GMnaWhstZwWkL0sNzZVW2QPqYajSbDPBS6W5BisVNEHuwh9FfxrUD9L+CL5Ke95D
+qE/JMSGk9aVWZ0afUaLKEDBGgGQKyr0+pxv4yyGfwwzL3zQRDa0V5SNp8BUFjIR
yu09KUMT8gU93VrmNKsMhZWw/wij7iMmwuGM+sEfgnpxpv5qlGCGt6JIjFTAjAqv
fY8t86414uxPd6fjwxxUDiV+bAgyLOun96G1y/sQ6RqT3CKB1+50bAArOLE5TQW+
pTxy0D57FziQQuzlCdaOefpkM+zo0cGElqxtoPMZKVitmSUhUrmagyJ9VTgnGxE=
=eSDE
-----END PGP SIGNATURE-----

--7iMSBzlTiPOCCT2k--

On Sat, May 12, 2012 at 04:55:08AM +0900, trans (Thomas Sawyer) wrote:
>=20
> Issue #6425 has been reported by trans (Thomas Sawyer).
>=20
> ----------------------------------------
> Bug #6425: Psych issue with !!omap
> https://bugs.ruby-lang.org/issues/6425
>=20
> Author: trans (Thomas Sawyer)
> Status: Open
> Priority: Normal
> Assignee:=20
> Category: lib
> Target version:=20
> ruby -v: ruby 1.9.3p125 (2012-02-16 revision 34643) [x86_64-linux]
>=20
>=20
> =3Dbegin
>=20
> Psych doesn't seem to know ordered map. It parses fine, but loose the typ=
e when round-tripped.
>=20
>   a =3D YAML.load %{
>     --- !!omap
>     a: 1
>     b: 2
>   }
>   =3D> {"a"=3D>1, "b"=3D>2}
>   a.class
>   =3D> Hash
>   puts a.to_yaml
>   ---
>   a: 1
>   b: 2
>=20
> =3Dend

Are you sure this is Psych and not Syck?  Psych raises a syntax error on
your example:

    irb(main):001:0> require 'psych'
    =3D> true
    irb(main):002:0> require 'yaml'
    =3D> true
    irb(main):003:0> a =3D YAML.load %{
    irb(main):004:0"   --- !!omap
    irb(main):005:0"   a: 1
    irb(main):006:0"   b: 2
    irb(main):007:0" }
    Psych::SyntaxError: (<unknown>): mapping values are not allowed in this=
 context at line 3 column 4
            from /Users/aaron/.local/lib/ruby/2.0.0/psych.rb:203:in `parse'
            from /Users/aaron/.local/lib/ruby/2.0.0/psych.rb:203:in `parse_=
stream'
            from /Users/aaron/.local/lib/ruby/2.0.0/psych.rb:151:in `parse'
            from /Users/aaron/.local/lib/ruby/2.0.0/psych.rb:127:in `load'
            from (irb):3
            from /Users/aaron/.local/bin/irb:12:in `<main>'
    irb(main):008:0>

Can you provide a runnable test case to reproduce your error?

--=20
Aaron Patterson
http://tenderlovemaking.com/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (Darwin)

iQEcBAEBAgAGBQJPsEepAAoJEJUxcLy0/6/GQi4IAJhxOM3goyii/hWbpCJOqMcw
GMnaWhstZwWkL0sNzZVW2QPqYajSbDPBS6W5BisVNEHuwh9FfxrUD9L+CL5Ke95D
+qE/JMSGk9aVWZ0afUaLKEDBGgGQKyr0+pxv4yyGfwwzL3zQRDa0V5SNp8BUFjIR
yu09KUMT8gU93VrmNKsMhZWw/wij7iMmwuGM+sEfgnpxpv5qlGCGt6JIjFTAjAqv
fY8t86414uxPd6fjwxxUDiV+bAgyLOun96G1y/sQ6RqT3CKB1+50bAArOLE5TQW+
pTxy0D57FziQQuzlCdaOefpkM+zo0cGElqxtoPMZKVitmSUhUrmagyJ9VTgnGxE=
=eSDE
-----END PGP SIGNATURE-----