summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2012-11-19 19:22:04 +0000
committerLars Wirzenius <liw@liw.fi>2012-11-19 19:22:04 +0000
commit35e67f58527a061956966053a95139c1322e62a3 (patch)
tree5ad7b723faa6faaac88515fe846ab09687bc0630
parent6f3cf8fc4adbc1e801e0f35d9dc3df4c539b66c5 (diff)
downloadobnam-35e67f58527a061956966053a95139c1322e62a3.tar.gz
Fix how OSError gets raised
-rw-r--r--NEWS2
-rw-r--r--obnamlib/vfs.py2
-rw-r--r--obnamlib/vfs_local.py6
3 files changed, 6 insertions, 4 deletions
diff --git a/NEWS b/NEWS
index c970eba3..f99fb4e3 100644
--- a/NEWS
+++ b/NEWS
@@ -39,6 +39,8 @@ Bug fixes:
Obnam was modifying a shared B-tree, Obnam would crash and abort a backup,
possibly leaving lock files lying around. Now a failure to look up a chunk
via its checksum is ignored, and the backup continues.
+* Bugs in how Python OSError exceptions were being raises have been fixed.
+ Error messages should now be somewhat clearer.
Version 1.2, released 2012-10-06
--------------------------------
diff --git a/obnamlib/vfs.py b/obnamlib/vfs.py
index 9ea90365..732b62af 100644
--- a/obnamlib/vfs.py
+++ b/obnamlib/vfs.py
@@ -638,7 +638,7 @@ class VfsTests(object): # pragma: no cover
def test_scan_tree_returns_nothing_if_listdir_fails(self):
self.set_up_scan_tree()
def raiser(dirname):
- raise OSError((123, 'oops', dirname))
+ raise OSError(123, 'oops', dirname)
def logerror(msg):
pass
self.fs.listdir2 = raiser
diff --git a/obnamlib/vfs_local.py b/obnamlib/vfs_local.py
index bf3250a5..5a8df3bc 100644
--- a/obnamlib/vfs_local.py
+++ b/obnamlib/vfs_local.py
@@ -143,7 +143,7 @@ class LocalFS(obnamlib.VirtualFileSystem):
atime_sec, atime_nsec, mtime_sec, mtime_nsec,
ctime_sec, ctime_nsec) = obnamlib._obnam.lstat(self.join(pathname))
if ret != 0:
- raise OSError((ret, os.strerror(ret), pathname))
+ raise OSError(ret, os.strerror(ret), pathname)
return obnamlib.Metadata(
st_dev=dev,
st_ino=ino,
@@ -172,7 +172,7 @@ class LocalFS(obnamlib.VirtualFileSystem):
def llistxattr(self, filename): # pragma: no cover
ret = obnamlib._obnam.llistxattr(self.join(filename))
if type(ret) is int:
- raise OSError((ret, os.strerror(ret), filename))
+ raise OSError(ret, os.strerror(ret), filename)
return [s for s in ret.split('\0') if s]
def lgetxattr(self, filename, attrname): # pragma: no cover
@@ -185,7 +185,7 @@ class LocalFS(obnamlib.VirtualFileSystem):
ret = obnamlib._obnam.lsetxattr(self.join(filename),
attrname, attrvalue)
if ret != 0:
- raise OSError((ret, os.strerror(ret), filename))
+ raise OSError(ret, os.strerror(ret), filename)
def lchown(self, pathname, uid, gid): # pragma: no cover
tracing.trace('lchown %s %d %d', pathname, uid, gid)