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
=== modified file 'NEWS'
--- NEWS 2010-09-10 05:13:57 +0000
+++ NEWS 2010-09-10 15:06:00 +0000
@@ -48,6 +48,10 @@
48* Raise ValueError instead of a string exception.48* Raise ValueError instead of a string exception.
49 (John Arbash Meinel, #586926)49 (John Arbash Meinel, #586926)
5050
51* Stop ``AttributeError: 'module' object has no attribute 'ElementTree'``
52 being thrown from ``xml_serializer`` on certain cElementTree setups.
53 (Martin [gz], #254278)
54
51Improvements55Improvements
52************56************
5357
5458
=== modified file 'bzrlib/xml_serializer.py'
--- bzrlib/xml_serializer.py 2010-02-17 17:11:16 +0000
+++ bzrlib/xml_serializer.py 2010-09-10 15:06:00 +0000
@@ -31,6 +31,8 @@
31 from xml.etree.cElementTree import (ElementTree, SubElement, Element,31 from xml.etree.cElementTree import (ElementTree, SubElement, Element,
32 XMLTreeBuilder, fromstring, tostring)32 XMLTreeBuilder, fromstring, tostring)
33 import xml.etree as elementtree33 import xml.etree as elementtree
34 # Also import ElementTree module so monkey-patching below always works
35 import xml.etree.ElementTree
34 except ImportError:36 except ImportError:
35 from cElementTree import (ElementTree, SubElement, Element,37 from cElementTree import (ElementTree, SubElement, Element,
36 XMLTreeBuilder, fromstring, tostring)38 XMLTreeBuilder, fromstring, tostring)

Subscribers

People subscribed via source and target branches