mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
- Bug #981530: Fix UnboundLocalError in shutil.rmtree(). This affects
the documented behavior: the function passed to the onerror() handler can now also be os.listdir. [I could've sworn I checked this in, but apparently I didn't, or it got lost???]
This commit is contained in:
parent
80e1f06594
commit
4a2ccdf781
1 changed files with 1 additions and 0 deletions
|
@ -128,6 +128,7 @@ def rmtree(path, ignore_errors=False, onerror=None):
|
|||
cmdtuples = []
|
||||
arg = path
|
||||
try:
|
||||
func = os.listdir # Make sure it isn't unset
|
||||
_build_cmdtuple(path, cmdtuples)
|
||||
for func, arg in cmdtuples:
|
||||
func(arg)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue