~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/util/_bencode_py.py

Merge up through 2.2.0.

Show diffs side-by-side

added added

removed removed

Lines of Context:
90
90
            raise TypeError
91
91
        try:
92
92
            r, l = self.decode_func[x[0]](x, 0)
93
 
        except (IndexError, KeyError):
94
 
            raise ValueError
 
93
        except (IndexError, KeyError, OverflowError), e:
 
94
            import sys
 
95
            raise ValueError, ValueError(str(e)), sys.exc_info()[2]
95
96
        if l != len(x):
96
97
            raise ValueError
97
98
        return r
154
155
        encode_int(int(x), r)
155
156
    encode_func[BooleanType] = encode_bool
156
157
 
 
158
from bzrlib._static_tuple_py import StaticTuple
 
159
encode_func[StaticTuple] = encode_list
 
160
try:
 
161
    from bzrlib._static_tuple_c import StaticTuple
 
162
except ImportError:
 
163
    pass
 
164
else:
 
165
    encode_func[StaticTuple] = encode_list
 
166
 
157
167
 
158
168
def bencode(x):
159
169
    r = []