]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rados.pyx: make all exceptions accept keyword arguments 23335/head
authorRishabh Dave <ridave@redhat.com>
Mon, 7 May 2018 12:57:13 +0000 (12:57 +0000)
committerNathan Cutler <ncutler@suse.com>
Mon, 30 Jul 2018 20:46:16 +0000 (22:46 +0200)
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>
(cherry picked from commit 16458025da1c5854f1ef3840ac7d58fb5a715c64)

src/pybind/rados/rados.pyx

index eede31e6c9af7d8069eb05ccad9fde2e2a058a53..67725295dcd36a760d65be63c944d0629dc43814 100644 (file)
@@ -337,21 +337,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)
@@ -359,6 +350,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