◐ Shell
clean mode source ↗

Fix unintended behavior change in elementtree introduced in #114269

Bug report

Bug description:

As it was discussed here, after merging of #114269 it.root is no longer None once an iterator is created. There was no intention to change this, it should be reverted.

Meanwhile, I think it will be good to add test for root attribute.

  • Right after function returned iterator: it.root must be None.
  • After iterator exhaustion: it.root must be an instance of xml.etree.ElementTree.Element.

CPython versions tested on:

CPython main branch

Operating systems tested on:

Other

Linked PRs