classification
Title: uu module catches a wrong exception type
Type: behavior Stage:
Components: Library (Lib) Versions: Python 2.5
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: giampaolo.rodola, gvanrossum
Priority: normal Keywords:

Created on 2007-11-02 23:13 by giampaolo.rodola, last changed 2007-11-03 15:17 by gvanrossum. This issue is now closed.

Messages (2)
msg57077 - (view) Author: Giampaolo Rodola' (giampaolo.rodola) * (Python committer) Date: 2007-11-02 23:13
uu module on line 53 erroneously tries to catch an AttributeError
exception type.

            try:
                mode = os.stat(in_file).st_mode
            except AttributeError:
                pass

This is not correct since os.stat(), as far as I know, should raise
OSError exceptions only.
This would turn in an error in case we pass a "broken" symlink as
in_file argument.
msg57083 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2007-11-03 15:17
You misunderstand. The try/except is there in case os.stat isn't defined 
or its result doesn't have a st_mode attribute. If the stat operation 
fails due to a problem with the file, there's not much point in proceeding 
since the subsequent open() call would fail the same way.
History
Date User Action Args
2007-11-03 15:17:45gvanrossumsetstatus: open -> closed
resolution: not a bug
messages: + msg57083
nosy: + gvanrossum
2007-11-02 23:13:53giampaolo.rodolacreate