]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
rados.pyx: make all exceptions accept keyword arguments
authorRishabh Dave <ridave@redhat.com>
Mon, 7 May 2018 12:57:13 +0000 (12:57 +0000)
committerRishabh Dave <ridave@redhat.com>
Mon, 7 May 2018 13:00:21 +0000 (13:00 +0000)
Moving the code that makes exceptions accept keyword arguments from the
exception OSError to Error prevents a crash when exceptions not
inheriting OSError are received.

Fixes: http://tracker.ceph.com/issues/24033
Signed-off-by: Rishabh Dave <ridave@redhat.com>
src/pybind/rados/rados.pyx

index 740732c6d75dc347ad2b00e33d4f8bf39590b5f4..a795fd7344e6c2baaecc91a2c372a415cd2ab2d7 100644 (file)
@@ -326,21 +326,12 @@ ADMIN_AUID = 0
 
 class Error(Exception):
     """ `Error` class, derived from `Exception` """
-    pass
-
-
-class InvalidArgumentError(Error):
-    pass
-
-
-class OSError(Error):
-    """ `OSError` class, derived from `Error` """
     def __init__(self, message, errno=None):
-        super(OSError, self).__init__(message)
+        super(Exception, self).__init__(message)
         self.errno = errno
 
     def __str__(self):
-        msg = super(OSError, self).__str__()
+        msg = super(Exception, self).__str__()
         if self.errno is None:
             return msg
         return '[errno {0}] {1}'.format(self.errno, msg)
@@ -348,6 +339,13 @@ class OSError(Error):
     def __reduce__(self):
         return (self.__class__, (self.message, self.errno))
 
+class InvalidArgumentError(Error):
+    pass
+
+class OSError(Error):
+    """ `OSError` class, derived from `Error` """
+    pass
+
 class InterruptedOrTimeoutError(OSError):
     """ `InterruptedOrTimeoutError` class, derived from `OSError` """
     pass