Merge lp:~gz/bzr/2.1_missing_ElementTree_254278 into lp:bzr/2.1

Proposed by Martin Packman
Status: Merged
Approved by: Vincent Ladeuil
Approved revision: no longer in the source branch.
Merged at revision: 4856
Proposed branch: lp:~gz/bzr/2.1_missing_ElementTree_254278
Merge into: lp:bzr/2.1
Diff against target: 27 lines (+6/-0)
2 files modified
NEWS (+4/-0)
bzrlib/xml_serializer.py (+2/-0)
To merge this branch: bzr merge lp:~gz/bzr/2.1_missing_ElementTree_254278
Reviewer Review Type Date Requested Status
Vincent Ladeuil Approve
Review via email: mp+35120@code.launchpad.net

Commit message

Prevent AttributeError in xml_serializer on certain cElementTree setups

Description of the change

Trying again to get this targeted at lp:bzr/2.1 rather than trunk...

One line fix for an old issue with ElementTree monkey-patching that can apparently still be hit in certain circumstances. I can't reproduce the problem myself, but confirmed on IRC that this change is sufficient, and the 2.3 approach of removing all that code entirely is not required.

To replay the fun as it happened, read:
<http://irclogs.ubuntu.com/2010/09/09/%23bzr.html#t15:03>

To post a comment you must log in.
Revision history for this message
Vincent Ladeuil (vila) wrote :

Ok, I'll land this one.

Yet, can you ensure this will get merged cleanly in 2.2 and dev ?
Ping me on IRC if you need help with that.

review: Approve
Revision history for this message
Vincent Ladeuil (vila) wrote :

sent to pqm by email

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'NEWS'
2--- NEWS 2010-09-10 05:13:57 +0000
3+++ NEWS 2010-09-10 15:06:00 +0000
4@@ -48,6 +48,10 @@
5 * Raise ValueError instead of a string exception.
6 (John Arbash Meinel, #586926)
7
8+* Stop ``AttributeError: 'module' object has no attribute 'ElementTree'``
9+ being thrown from ``xml_serializer`` on certain cElementTree setups.
10+ (Martin [gz], #254278)
11+
12 Improvements
13 ************
14
15
16=== modified file 'bzrlib/xml_serializer.py'
17--- bzrlib/xml_serializer.py 2010-02-17 17:11:16 +0000
18+++ bzrlib/xml_serializer.py 2010-09-10 15:06:00 +0000
19@@ -31,6 +31,8 @@
20 from xml.etree.cElementTree import (ElementTree, SubElement, Element,
21 XMLTreeBuilder, fromstring, tostring)
22 import xml.etree as elementtree
23+ # Also import ElementTree module so monkey-patching below always works
24+ import xml.etree.ElementTree
25 except ImportError:
26 from cElementTree import (ElementTree, SubElement, Element,
27 XMLTreeBuilder, fromstring, tostring)

Subscribers

People subscribed via source and target branches