Message338291
> Victor, as much as I appreciate backwards compatibility, I really don't think it's a big deal in this case.
In short, the XML serialization is no longer deterministic. It depends in which order attributes are defined. Example:
---
from xml.etree import ElementTree as ET
document = ET.Element('document')
document.attrib['a'] = '1'
document.attrib['b'] = '2'
ET.dump(document)
document = ET.Element('document')
document.attrib['b'] = '2'
document.attrib['a'] = '1'
ET.dump(document)
---
Python 3.7 output:
---
<document a="1" b="2" />
<document a="1" b="2" />
---
Python 3.8 output:
---
<document a="1" b="2" />
<document b="2" a="1" />
---
On this example, it's obvious that the attributes are defined in a different order, but the code which generates the XML document can be way more complex and use unordered data structures like set().
Why does it matter? Most programs compare XML using basic string comparison, they don't implement smart XML comparison which ignore attributes order.
Concrete example:
* A program which rewrites the XML on disk if attribute order changes (useless disk write).
* Version Control System (Git, hg, svn, whatever) sees the file as modified and produces a change which can be unexpected and annoy users (use more disk space, more network bandwidth, etc.)
* https://reproducible-builds.org/
* It breaks docutils unit tests which uses straightfoward assertEqual(). docutils is just one example: it's not hard to imagine many other applications using XML and which use a similar check.
* etc.
It's not just a matter of parsers.
> My (somewhat educated) gut feeling is that most users simply won't care or won't even notice the change.
... Really? Why do you think that so many people are involved in this issue if nobody cares of XML attribute order? :-) |
|
Date |
User |
Action |
Args |
2019-03-18 21:55:35 | vstinner | set | recipients:
+ vstinner, rhettinger, scoder, taleinat, nedbat, eli.bendersky, lukasz.langa, serhiy.storchaka, matrixise, sivert, Mariatta, dfrojas |
2019-03-18 21:55:35 | vstinner | set | messageid: <1552946135.51.0.0762725164817.issue34160@roundup.psfhosted.org> |
2019-03-18 21:55:35 | vstinner | link | issue34160 messages |
2019-03-18 21:55:35 | vstinner | create | |
|