Projet

Général

Profil

0001-python-do-not-fail-displaying-a-non-C-error-fixes-38.patch

Frédéric Péters, 23 octobre 2013 15:35

Télécharger (1,34 ko)

Voir les différences:

Subject: [PATCH] python: do not fail displaying a non-C error (fixes #3866)

The binding does a raise Error('failed to create object') but the local Error
exception class expects a lasso error code, and will thus fail if printed.

  File ".../lasso.py", line 54, in __str__
    return '<lasso.%s(%s): %s>' % (self.__class__.__name__, self.code,
             _lasso.strError(self.code))
  TypeError: an integer is required
 bindings/python/lang.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
bindings/python/lang.py
168 168
            raise exception
169 169

  
170 170
    def __str__(self):
171
        return '<lasso.%s(%s): %s>' % (self.__class__.__name__, self.code, _lasso.strError(self.code))
171
        if self.code:
172
            return '<lasso.%s(%s): %s>' % (self.__class__.__name__, self.code, _lasso.strError(self.code))
173
        else:
174
            return '<lasso.%s: %s>' % (self.__class__.__name__, self.message)
172 175

  
173 176
    def __getitem__(self, i):
174 177
        # compatibility with SWIG bindings
175
-