making safe_dump / safe_load the defaults

James Broadhead <[email protected]> Thu, 26 Nov 2015 23:17:36 +0000
Newsgroups gmane.text.yaml.general
Message-ID <CA+hid6FnRVBjrqtp2-s2NsLOW3EU15Bf489n2PV++MkbPLAVRQ@mail.gmail.com>
Hi there!

I would like to propose that the behaviour of the current yaml.safe_load /
yaml.safe_dump functions become the defaults available through
yaml.load/yaml.dump, and that the full-featured .load/.dump be renamed to
indicate that care must be taken when using them.
This relates to the github issue: https://github.com/yaml/pyyaml/issues/5.
I do not have access to file TRAC issues.

The current default is quite intuitive, and I believe breaks the principle
of least-surprise to developers attempting to use the library without
careful reading of the docs. I understand the argument of "they should read
the docs" / "they should not load untrusted content", but am aware that
this advice is not followed in the real world, and have encountered many
instances of use of .load where .safe_load was entirely sufficient &
preferable.

I have a proposal branch here: https://github.com/yaml/pyyaml/pull/21 which
deprecates the 'Loader'/'Dumper' kwargs to .load/.dump [_all], and bumps
the minor version number. If this approach is acceptable, the actual
change-over would probably call for a major-version release. I welcome
comments on the implementation or approach.

I could not find much prior discussion of this issue on the mailing-lists
or in TRAC, which surprised me. Am I looking in the wrong places?

James

------------------------------------------------------------------------------
Go from Idea to Many App Stores Faster with Intel(R) XDK
Give your users amazing mobile app experiences with Intel(R) XDK.
Use one codebase in this all-in-one HTML5 development environment.
Design, debug & build mobile apps & 2D/3D high-impact games for multiple OSs.
http://pubads.g.doubleclick.net/gampad/clk?id=254741551&iu=/4140

_______________________________________________
Yaml-core mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/yaml-core