From 080548538d4e2622c04f1a5f9370d8c1889c2959 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?= Date: Wed, 23 Oct 2013 15:31:23 +0200 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 '' % (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(-) diff --git a/bindings/python/lang.py b/bindings/python/lang.py index 4c3d7cc5..72c2911c 100644 --- a/bindings/python/lang.py +++ b/bindings/python/lang.py @@ -168,7 +168,10 @@ class Error(Exception): raise exception def __str__(self): - return '' % (self.__class__.__name__, self.code, _lasso.strError(self.code)) + if self.code: + return '' % (self.__class__.__name__, self.code, _lasso.strError(self.code)) + else: + return '' % (self.__class__.__name__, self.message) def __getitem__(self, i): # compatibility with SWIG bindings