mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Remove unused names in except clauses
This commit is contained in:
parent
25785e9ca5
commit
cfcc9779fc
1 changed files with 3 additions and 3 deletions
|
@ -267,7 +267,7 @@ def rmtree(path, ignore_errors=False, onerror=None):
|
||||||
names = []
|
names = []
|
||||||
try:
|
try:
|
||||||
names = os.listdir(path)
|
names = os.listdir(path)
|
||||||
except os.error as err:
|
except os.error:
|
||||||
onerror(os.listdir, path, sys.exc_info())
|
onerror(os.listdir, path, sys.exc_info())
|
||||||
for name in names:
|
for name in names:
|
||||||
fullname = os.path.join(path, name)
|
fullname = os.path.join(path, name)
|
||||||
|
@ -280,7 +280,7 @@ def rmtree(path, ignore_errors=False, onerror=None):
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
os.remove(fullname)
|
os.remove(fullname)
|
||||||
except os.error as err:
|
except os.error:
|
||||||
onerror(os.remove, fullname, sys.exc_info())
|
onerror(os.remove, fullname, sys.exc_info())
|
||||||
try:
|
try:
|
||||||
os.rmdir(path)
|
os.rmdir(path)
|
||||||
|
@ -323,7 +323,7 @@ def move(src, dst):
|
||||||
raise Error("Destination path '%s' already exists" % real_dst)
|
raise Error("Destination path '%s' already exists" % real_dst)
|
||||||
try:
|
try:
|
||||||
os.rename(src, real_dst)
|
os.rename(src, real_dst)
|
||||||
except OSError as exc:
|
except OSError:
|
||||||
if os.path.isdir(src):
|
if os.path.isdir(src):
|
||||||
if _destinsrc(src, dst):
|
if _destinsrc(src, dst):
|
||||||
raise Error("Cannot move a directory '%s' into itself '%s'." % (src, dst))
|
raise Error("Cannot move a directory '%s' into itself '%s'." % (src, dst))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue