aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMathieu Bridon <bochecha@fedoraproject.org>2012-11-28 23:44:39 +0800
committerMathieu Bridon <bochecha@fedoraproject.org>2012-11-28 23:44:39 +0800
commit2023730c6ece6edf6ddb8f73d80409230fc06089 (patch)
treefd6aec39cd07c3395baa409aa01d34ab19ff1b42
parent65c3b3f1c054e79e3ac85b8c47f403e3c4c2e181 (diff)
downloadpycanberra-2023730c6ece6edf6ddb8f73d80409230fc06089.tar
pycanberra-2023730c6ece6edf6ddb8f73d80409230fc06089.tar.gz
Do not use the exceptions module
On Python 2, it is imported automatically, so there really isn't any need to import it, it's classes can be used directly: $ python2 >>> e = Exception() >>> import exceptions >>> isinstance(e, exceptions.Exception) True Also, it doesn't exist on Python 3, so removing it will make the port easier.
-rw-r--r--pycanberra.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/pycanberra.py b/pycanberra.py
index 6b1a064..a1bae5d 100644
--- a/pycanberra.py
+++ b/pycanberra.py
@@ -4,7 +4,6 @@
# License: LGPL 2.1
##########################################################################
from ctypes import *
-import exceptions
import time
# /**
@@ -519,16 +518,16 @@ def GetApi():
# int ca_proplist_set(ca_proplist *p, const char *key, const void *data, size_t nbytes);
-class CanberraException(exceptions.Exception):
+class CanberraException(Exception):
def __init__(self, err, *args, **kwargs):
self._err = err
- super(exceptions.Exception, self).__init__(*args, **kwargs)
+ super(Exception, self).__init__(*args, **kwargs)
def get_error(self):
return self._err
def __str__(self):
- return super(exceptions.Exception, self).__str__() + " (error %d)" % self._err
+ return super(Exception, self).__str__() + " (error %d)" % self._err
class Canberra(object):