[ python-Bugs-981530 ] UnboundLocalError in shutil.rmtree()
SourceForge.net
noreply at sourceforge.net
Mon Jun 28 16:32:44 EDT 2004
Bugs item #981530, was opened at 2004-06-28 16:22
Message generated for change (Comment added) made by gvanrossum
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=981530&group_id=5470
Category: Python Library
Group: Python 2.3
Status: Open
>Resolution: Fixed
Priority: 5
Submitted By: Guido van Rossum (gvanrossum)
Assigned to: Guido van Rossum (gvanrossum)
Summary: UnboundLocalError in shutil.rmtree()
Initial Comment:
It is possible for the call to
onerror(func, arg, exc)
to be triggered by an os.error raised by the os.listdir()
call in _build_cmdtuple() rather than in the "for func, arg
in cmdtuples" loop.
In that case, func isn't set yet, and an
UnboundLocalError is raised rather than onerror() being
called.
A quick fix for this is to set func=None before calling
_build_cmdtuple, but the docs guarantee that it is set
to a function when onerror is called (and specifically,
os.remove and os.rmdir).
I propose to set func = os.listdir before calling
_build_cmdtuple() and fixing the docs. I can backport
this to 2.3.
----------------------------------------------------------------------
>Comment By: Guido van Rossum (gvanrossum)
Date: 2004-06-28 16:32
Message:
Logged In: YES
user_id=6380
Fixed in 2.3 and 2.4.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=981530&group_id=5470
More information about the Python-bugs-list
mailing list