Rev 1880: Create OSError in bindings rather than converting to it later on. in file:///data/jelmer/bzr-svn/trunk/

Jelmer Vernooij jelmer at samba.org
Tue Sep 9 03:45:56 BST 2008


At file:///data/jelmer/bzr-svn/trunk/

------------------------------------------------------------
revno: 1880
revision-id: jelmer at samba.org-20080909024554-oniqimfkoxclpurl
parent: jelmer at samba.org-20080909014656-snrv0sekt6ocutga
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: trunk
timestamp: Tue 2008-09-09 04:45:54 +0200
message:
  Create OSError in bindings rather than converting to it later on.
modified:
  errors.py                      errors.py-20061226172623-w1sbj8ynpo0eojqp-1
  tests/test_errors.py           test_errors.py-20070129114605-ban03f32t6ja14ez-1
  util.c                         util.c-20080531154025-s8ef6ej9tytsnkkw-1
=== modified file 'errors.py'
--- a/errors.py	2008-09-05 12:38:20 +0000
+++ b/errors.py	2008-09-09 02:45:54 +0000
@@ -145,8 +145,6 @@
         return ConnectionError(msg=msg)
     elif num == ERR_RA_DAV_REQUEST_FAILED:
         return DavRequestFailed(msg)
-    elif num > 0 and num < 1000:
-        return OSError(num, msg)
     else:
         return err
 

=== modified file 'tests/test_errors.py'
--- a/tests/test_errors.py	2008-08-25 01:58:11 +0000
+++ b/tests/test_errors.py	2008-09-09 02:45:54 +0000
@@ -37,10 +37,6 @@
 
         self.assertRaises(ConnectionReset, test_throws_svn)
 
-    def test_convert_error_oserror(self):
-        self.assertIsInstance(convert_error(SubversionException("foo", 13)),
-                OSError)
-
     def test_convert_error_unknown(self):
         self.assertIsInstance(convert_error(SubversionException("foo", -4)),
                 SubversionException)

=== modified file 'util.c'
--- a/util.c	2008-09-09 01:09:58 +0000
+++ b/util.c	2008-09-09 02:45:54 +0000
@@ -64,6 +64,11 @@
 	PyObject *coremod;
 	PyObject *excval, *excobj;
 
+	if (error->apr_err < 1000) {
+		PyErr_SetObject(PyExc_OSError, Py_BuildValue("(iz)", error->apr_err, error->message));
+		return;
+	}
+
 	coremod = PyImport_ImportModule("bzrlib.plugins.svn.core");
 
 	if (coremod == NULL) {




More information about the bazaar-commits mailing list