-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
hi,
when re-raising an exception, it is better to use a plain simple
'raise'. Code example:
try:
open('/nonexistent')
except IOError:
print 'error'
raise IOError
The above code has a defect: the new IOError is empty, that is, all info
regrading the exception (e.g. the error codes errno & strerror) are
lost; whereas e.g. in directory.py at line 576 it is needed.
I changed the code in all places where I found it; for the above code
example, it would be
try:
open('/nonexistent')
except IOError:
print 'error'
raise
a.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iEYEARECAAYFAkltBm4ACgkQ9B/tjjP8QKSrzACeOaDK5QDw9iu22otAdYCg/LIL
MUcAnRDTyRMAtygu3blcg/QT6Rk4OFCp
=SfQH
-----END PGP SIGNATURE-----
--- ./util/vfs.py~1.8.3 2008-11-25 20:41:30.000000000 +0100
+++ ./util/vfs.py 2009-01-13 21:16:59.000000000 +0100
@@ -150,12 +150,12 @@
os.makedirs(os.path.dirname(overlay), mode=04775)
except IOError:
_debug_('error creating dir %s' % os.path.dirname(overlay), DWARNING)
- raise IOError
+ raise
try:
return file(overlay, mode)
except IOError:
_debug_('error opening file %s' % overlay, DWARNING)
- raise IOError
+ raise
def codecs_open(name, mode, encoding):
@@ -173,12 +173,12 @@
os.makedirs(os.path.dirname(overlay))
except IOError:
_debug_('error creating dir %s' % os.path.dirname(overlay), DWARNING)
- raise IOError
+ raise
try:
return codecs.open(overlay, mode, encoding=encoding)
except IOError, e:
_debug_('error opening file %s' % overlay, DWARNING)
- raise IOError, e
+ raise
def listdir(directory, handle_exception=True, include_dot_files=False, include_overlay=False):
@@ -215,7 +215,7 @@
_debug_('Cannot list dir %r: %s' % (directory, why), DWARNING)
traceback.print_exc()
if not handle_exception:
- raise OSError
+ raise
return []
------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Freevo-devel mailing list
Freevo-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freevo-devel