Ticket #116 (closed defect: fixed)
the order of keys is important
| Reported by: | Andrey Somov <py4fun@…> | Owned by: | xi |
|---|---|---|---|
| Priority: | low | Component: | pyyaml |
| Severity: | minor | Keywords: | |
| Cc: |
Description
When PyYAML is run on alternative VM (jython for instance) the order of the dictionary keys may be different. Unfortunately PyYAML relies on the order in some cases. The attached patches show that tests fail only when the sequence of the keys is reversed. These cases were found under Java 5. (for Java 6 the order is the same as for CPython). To avoid unexpected bugs in future it would be safe to change the implementation to use a kind of an ordered dictionary.(or to respect the order in some other way). There is no guarantee the list is complete. This is just a coincidence it was found.
Attachments
Change History
comment:1 Changed 4 years ago by xi
- Status changed from new to closed
- Resolution set to fixed
It appears that emitter.py has indeed a very subtle bug, I think I fixed in [345]. Thank you for reporting it.
I can't see any problem with the code in scanner.py. Once i fixed the obvious error in
keys_rev = keys_rev.reverse()
the tests pass fine.

