From 2dbca5edf3a74437d0d8cc098c556a4a18ddb247 Mon Sep 17 00:00:00 2001 From: Benjamin Dauvergne Date: Wed, 24 Feb 2021 22:59:24 +0100 Subject: [PATCH] Fix: python3 bindings (#51249) The __str__ method called itself, resulting in an RecursionError. ====================================================================== ERROR: test14 (__main__.BindingTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "./binding_tests.py", line 336, in test14 assert isinstance(str(cm.exception), str) File "../lasso.py", line 69, in __str__ return '' % (self.__class__.__name__, self) File "../lasso.py", line 69, in __str__ return '' % (self.__class__.__name__, self) File "../lasso.py", line 69, in __str__ return '' % (self.__class__.__name__, self) [Previous line repeated 489 more times] File "../lasso.py", line 68, in __str__ if sys.version_info >= (3,): RecursionError: maximum recursion depth exceeded in comparison ---------------------------------------------------------------------- --- bindings/python/lang.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bindings/python/lang.py b/bindings/python/lang.py index e7bea627..c441ffb6 100644 --- a/bindings/python/lang.py +++ b/bindings/python/lang.py @@ -189,7 +189,7 @@ class Error(Exception): return '' % (self.__class__.__name__, self.code, _lasso.strError(self.code)) else: if sys.version_info >= (3,): - return '' % (self.__class__.__name__, self) + return '' % (self.__class__.__name__, super().__str__()) else: return '' % (self.__class__.__name__, self.message)