From 1b957b7b50c60e115493110bdb68489ad2a1a8b2 Mon Sep 17 00:00:00 2001 From: "test'\"/script/textarea" Date: Thu, 30 Jun 2016 22:54:35 +0200 Subject: [PATCH] Python 3 compatibility: raise unicode exception messages In order to make exceptions display well with the Python binding on Python 3.x, return exception message as unicode/str rather than str/bytes. --- bindings/python/unicorn/unicorn.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bindings/python/unicorn/unicorn.py b/bindings/python/unicorn/unicorn.py index e1c94491..dfca2460 100644 --- a/bindings/python/unicorn/unicorn.py +++ b/bindings/python/unicorn/unicorn.py @@ -156,7 +156,7 @@ class UcError(Exception): self.errno = errno def __str__(self): - return _uc.uc_strerror(self.errno) + return _uc.uc_strerror(self.errno).decode('ascii') # return the core's version