Bug #293998 - Use OSError.errno instead of trying to subscript the exception
authorZac Medico <zmedico@gentoo.org>
Sun, 22 Nov 2009 01:58:05 +0000 (01:58 -0000)
committerZac Medico <zmedico@gentoo.org>
Sun, 22 Nov 2009 01:58:05 +0000 (01:58 -0000)
when handling errno.EXDEV in movefile(), since exceptions do not support
subscripting in python3.

svn path=/main/trunk/; revision=14873

pym/portage/__init__.py

index 4b6f841d46f67ea9a1f1043765a5bc2f96b5ab89..2641472e582a89f3a34e858b66ffcd35f05123a2 100644 (file)
@@ -7512,10 +7512,8 @@ def movefile(src, dest, newmtime=None, sstat=None, mysettings=None,
                        else:
                                ret=os.rename(src,dest)
                        renamefailed=0
-               except SystemExit as e:
-                       raise
-               except Exception as e:
-                       if e[0]!=errno.EXDEV:
+               except OSError as e:
+                       if e.errno != errno.EXDEV:
                                # Some random error.
                                print(_("!!! Failed to move %(src)s to %(dest)s") % {"src": src, "dest": dest})
                                print("!!!",e)