1. Kirill Simonov
  2. pyyaml
  3. Issues
Issue #21 new

Python implementation of safe_dump converts string of an int into an int

Timothy Corbett-Clark
created an issue

So a string containing something which looks like an integer will be dumped in to yaml which is an integer. Hence round tripping is not true. yaml.dump seems to work correctly by preserving the escaping quotes:

assert yaml.safe_load(yaml.safe_dump('2')) == 2
assert yaml.load(yaml.dump('2')) == '2'

Comments (4)

  1. Log in to comment