classification
Title: ElementTree.Element and cElementTree.Element have slightly different repr
Type: behavior Stage: resolved
Components: XML Versions: Python 3.1, Python 2.7, Python 2.6
process
Status: closed Resolution: fixed
Dependencies: Superseder: Update ElementTree with upstream changes
View: 6472
Assigned To: Nosy List: Neil Muller, effbot, flox, hodgestar, jerith, russell
Priority: normal Keywords: patch

Created on 2009-06-07 14:08 by Neil Muller, last changed 2010-03-11 14:59 by flox. This issue is now closed.

Files
File name Uploaded Description Edit
repr-fix.diff Neil Muller, 2009-06-07 14:08 Fix & test case for repr behaviour
Messages (4)
msg89035 - (view) Author: Neil Muller (Neil Muller) Date: 2009-06-07 14:08
ElementTree and cElementTree give slightly different results for
repr(Element):

>>> import xml.etree.ElementTree as ET
>>> import xml.etree.cElementTree as cET
>>> repr(ET.ElementTree('tag'))
'<Element tag at b7cf506c>'
>>> repr(cET.ElementTree('tag')
"<Element 'tag' at 0xb7c266f8>"

The quoting around the tag name is missing from ElementTree.

This inconsistency seems pointless.

Attached patch changes ElementTree to match cElementTree behaviour, and
adds a test.
msg89053 - (view) Author: Neil Muller (Neil Muller) Date: 2009-06-07 20:13
Same issue affects python 3k - the patch applies there cleanly as well.
msg99405 - (view) Author: Florent Xicluna (flox) * (Python committer) Date: 2010-02-16 13:11
Fixed with upstream. See #6472.
msg100864 - (view) Author: Florent Xicluna (flox) * (Python committer) Date: 2010-03-11 14:59
Fixed in trunk with #6472.
History
Date User Action Args
2010-03-11 14:59:13floxsetstatus: open -> closed
superseder: Update ElementTree with upstream changes
messages: + msg100864

dependencies: - Update ElementTree with upstream changes
resolution: fixed
stage: resolved
2010-02-16 13:11:28floxsetpriority: normal

nosy: + flox
messages: + msg99405

dependencies: + Update ElementTree with upstream changes
components: + XML, - Library (Lib)
2009-06-08 05:07:35jerithsetnosy: + jerith
2009-06-07 20:13:56Neil Mullersetmessages: + msg89053
2009-06-07 15:39:46hodgestarsetnosy: + hodgestar
2009-06-07 15:32:43russellsetnosy: + russell
2009-06-07 14:08:15Neil Mullercreate