~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/util/_bencode_py.py

  • Committer: Patch Queue Manager
  • Date: 2012-06-18 12:59:19 UTC
  • mfrom: (6524.1.1 bzr.dev)
  • Revision ID: pqm@pqm.ubuntu.com-20120618125919-jf2dy5p1apoljtan
(jelmer) Merge 2.5. (Jelmer Vernooij)

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
#
16
16
# Modifications copyright (C) 2008 Canonical Ltd
17
17
 
 
18
from __future__ import absolute_import
 
19
 
18
20
class BDecoder(object):
19
21
 
20
22
    def __init__(self, yield_tuples=False):
90
92
            raise TypeError
91
93
        try:
92
94
            r, l = self.decode_func[x[0]](x, 0)
93
 
        except (IndexError, KeyError):
94
 
            raise ValueError
 
95
        except (IndexError, KeyError, OverflowError), e:
 
96
            import sys
 
97
            raise ValueError, ValueError(str(e)), sys.exc_info()[2]
95
98
        if l != len(x):
96
99
            raise ValueError
97
100
        return r