Commit with non-ascii str committer value breaks with ElementTree 1.3
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Bazaar |
Fix Released
|
Low
|
Martin Packman |
Bug Description
On Python 2.7 the following tests (which are all the same test method) fail:
bt.
bt.
bt.
The error is along the lines of:
Traceback (most recent call last):
File ".\bzrlib\
File "<string>", line 4, in commit_write_locked
File ".\bzrlib\
result = WorkingTree3.
File "<string>", line 4, in commit_write_locked
File ".\bzrlib\
*args, **kwargs)
File ".\bzrlib\
File ".\bzrlib\
File ".\bzrlib\
result = func(*args, **kwargs)
File ".\bzrlib\
self.rev_id = self.builder.
File ".\bzrlib\
File ".\bzrlib\
File ".\bzrlib\
text = self._serialize
File ".\bzrlib\
return tostring(
File "...\python-
File "...\python-
File "...\python-
v = _escape_attrib(v, encoding)
File ".\bzrlib\
File "...\python-
"cannot serialize %r (type %s)" % (text, type(text)
TypeError: cannot serialize 'Erik B\xe5gfors <test@user>' (type str)
If the monkey patching of escaping functions noted in bug 614522 is removed, the error ends instead:
...
File "...\python-
v = _escape_attrib(v, encoding)
File "...\python-
return text.encode(
UnicodeDeco
Though this throws due to the update to ElementTree 1.3, the basic problem is the test passes a non-ascii str as the committer to the working tree commit method.
The tests can easily be fixed by the addition of a 'u' prefix, but shouldn't commit really be checking that it's given a value for committer it can use without things potentially breaking during serialisation?
Related branches
- Vincent Ladeuil: Approve
- John A Meinel: Pending requested
-
Diff: 46 lines (+13/-1)3 files modifiedbzrlib/repository.py (+2/-0)
bzrlib/tests/per_repository/test_commit_builder.py (+10/-0)
bzrlib/tests/test_testament.py (+1/-1)
Changed in bzr: | |
importance: | Undecided → Low |
status: | New → Confirmed |
tags: |
added: python27 removed: python2.7 |
In absence of advice otherwise, I'll add a guard in commit that throws a UnicodeDecodeError on non-ascii byte strings rather than letting it through to the xml output layer.