This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
标题: ElementTree.Element and cElementTree.Element have slightly different repr
类型: behavior Stage: resolved
Components: XML Versions: Python 3.1, Python 2.7, Python 2.6
process
状态: closed Resolution: fixed
Dependencies: 后续: Update ElementTree with upstream changes
View: 6472
分配给: 抄送列表: Neil Muller, effbot, flox, hodgestar, jerith, russell
优先级: normal 关键字: patch

Created on 2009-06-07 14:08 by Neil Muller, last changed 2022-04-11 14:56 by admin. This issue is now closed.

文件
文件名 上传时间 Description 编辑
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) 日期: 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) 日期: 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) 日期: 2010-02-16 13:11
Fixed with upstream. See #6472.
msg100864 - (view) Author: Florent Xicluna (flox) * (Python committer) 日期: 2010-03-11 14:59
Fixed in trunk with #6472.
历史
日期 用户 动作 参数
2022-04-11 14:56:49admin修改github: 50479
2010-03-11 14:59:13flox修改状态: open -> closed
后续: Update ElementTree with upstream changes
消息: + msg100864

dependencies: - Update ElementTree with upstream changes
resolution: fixed
stage: resolved
2010-02-16 13:11:28flox修改优先级: normal

抄送: + flox
消息: + msg99405

dependencies: + Update ElementTree with upstream changes
components: + XML, - Library (Lib)
2009-06-08 05:07:35jerith修改抄送: + jerith
2009-06-07 20:13:56Neil Muller修改消息: + msg89053
2009-06-07 15:39:46hodgestar修改抄送: + hodgestar
2009-06-07 15:32:43russell修改抄送: + russell
2009-06-07 14:08:15Neil Muller创建