cpython: 6cfe2982de42 (original) (raw)

Mercurial > cpython

changeset 81017:6cfe2982de42

Use OESeeror instead of os.error (#16720) Patch by Serhiy Storchaka. [#16720]

Andrew Svetlov andrew.svetlov@gmail.com
date Mon, 24 Dec 2012 19:58:48 +0200
parents a7c9869a5114
children 33494e332e67
files Lib/cgi.py Lib/os.py Lib/test/test_bytes.py Lib/test/test_os.py Lib/test/test_pty.py Tools/freeze/bkfile.py Tools/freeze/freeze.py Tools/scripts/byext.py Tools/scripts/byteyears.py Tools/scripts/checkpyc.py Tools/scripts/copytime.py Tools/scripts/finddiv.py Tools/scripts/findlinksto.py Tools/scripts/fixcid.py Tools/scripts/ftpmirror.py Tools/scripts/linktree.py Tools/scripts/pathfix.py Tools/scripts/pindent.py Tools/scripts/treesync.py Tools/scripts/untabify.py Tools/scripts/which.py
diffstat 21 files changed, 56 insertions(+), 56 deletions(-)[+] [-] Lib/cgi.py 2 Lib/os.py 14 Lib/test/test_bytes.py 2 Lib/test/test_os.py 12 Lib/test/test_pty.py 2 Tools/freeze/bkfile.py 4 Tools/freeze/freeze.py 2 Tools/scripts/byext.py 2 Tools/scripts/byteyears.py 2 Tools/scripts/checkpyc.py 4 Tools/scripts/copytime.py 4 Tools/scripts/finddiv.py 2 Tools/scripts/findlinksto.py 2 Tools/scripts/fixcid.py 8 Tools/scripts/ftpmirror.py 20 Tools/scripts/linktree.py 6 Tools/scripts/pathfix.py 10 Tools/scripts/pindent.py 6 Tools/scripts/treesync.py 2 Tools/scripts/untabify.py 4 Tools/scripts/which.py 2

line wrap: on

line diff

--- a/Lib/cgi.py +++ b/Lib/cgi.py @@ -950,7 +950,7 @@ def print_directory(): try: pwd = os.getcwd() except OSError as msg:

--- a/Lib/os.py +++ b/Lib/os.py @@ -275,7 +275,7 @@ def removedirs(name): while head and tail: try: rmdir(head)

@@ -302,7 +302,7 @@ def renames(old, new): if head and tail: try: removedirs(head)

all.extend(["makedirs", "removedirs", "renames"]) @@ -372,10 +372,10 @@ def walk(top, topdown=True, onerror=None # minor reason when (say) a thousand readable directories are still # left to visit. That logic is copied here. try:

@@ -477,7 +477,7 @@ if {open, stat} <= supports_dir_fd and { try: orig_st = stat(name, dir_fd=topfd, follow_symlinks=follow_symlinks) dirfd = open(name, O_RDONLY, dir_fd=topfd)

@@ -572,7 +572,7 @@ def _execvpe(file, args, env=None): fullname = path.join(dir, file) try: exec_func(fullname, *argrest)

@@ -830,7 +830,7 @@ if _exists("fork") and not _exists("spaw elif WIFEXITED(sts): return WEXITSTATUS(sts) else:

def spawnv(mode, file, args): """spawnv(mode, file, args) -> integer

--- a/Lib/test/test_bytes.py +++ b/Lib/test/test_bytes.py @@ -773,7 +773,7 @@ class ByteArrayTest(BaseBytesTest): finally: try: os.remove(tfn)

def test_reverse(self):

--- a/Lib/test/test_os.py +++ b/Lib/test/test_os.py @@ -1190,31 +1190,31 @@ if sys.platform != 'win32': if hasattr(os, 'setuid'): def test_setuid(self): if os.getuid() != 0:

if hasattr(os, 'setgid'): def test_setgid(self): if os.getuid() != 0:

if hasattr(os, 'seteuid'): def test_seteuid(self): if os.getuid() != 0:

if hasattr(os, 'setegid'): def test_setegid(self): if os.getuid() != 0:

if hasattr(os, 'setreuid'): def test_setreuid(self): if os.getuid() != 0:

@@ -1228,7 +1228,7 @@ if sys.platform != 'win32': if hasattr(os, 'setregid'): def test_setregid(self): if os.getuid() != 0:

--- a/Lib/test/test_pty.py +++ b/Lib/test/test_pty.py @@ -187,7 +187,7 @@ class PtyTest(unittest.TestCase): ##debug("Reading from master_fd now that the child has exited") ##try: ## s1 = os.read(master_fd, 1024)

--- a/Tools/freeze/bkfile.py +++ b/Tools/freeze/bkfile.py @@ -7,11 +7,11 @@ class _BkFile: self.__backup = file + '~' try: os.unlink(self.__backup)

--- a/Tools/freeze/freeze.py +++ b/Tools/freeze/freeze.py @@ -311,7 +311,7 @@ def main(): try: os.mkdir(odir) print("Created output directory", odir)

--- a/Tools/scripts/byext.py +++ b/Tools/scripts/byext.py @@ -25,7 +25,7 @@ class Stats: self.addstats("", "dirs", 1) try: names = os.listdir(dir)

--- a/Tools/scripts/byteyears.py +++ b/Tools/scripts/byteyears.py @@ -43,7 +43,7 @@ def main(): for filename in sys.argv[1:]: try: st = statfunc(filename)

--- a/Tools/scripts/checkpyc.py +++ b/Tools/scripts/checkpyc.py @@ -24,7 +24,7 @@ def main(): for dirname in sys.path: try: names = os.listdir(dirname)

@@ -34,7 +34,7 @@ def main(): name = os.path.join(dirname, name) try: st = os.stat(name)

--- a/Tools/scripts/copytime.py +++ b/Tools/scripts/copytime.py @@ -13,12 +13,12 @@ def main(): file1, file2 = sys.argv[1], sys.argv[2] try: stat1 = os.stat(file1)

--- a/Tools/scripts/finddiv.py +++ b/Tools/scripts/finddiv.py @@ -70,7 +70,7 @@ def process(filename, listnames): def processdir(dir, listnames): try: names = os.listdir(dir)

--- a/Tools/scripts/findlinksto.py +++ b/Tools/scripts/findlinksto.py @@ -36,7 +36,7 @@ def visit(prog, dirname, names): linkto = os.readlink(name) if prog.search(linkto) is not None: print(name, '->', linkto)

if name == 'main':

--- a/Tools/scripts/fixcid.py +++ b/Tools/scripts/fixcid.py @@ -97,7 +97,7 @@ def recursedown(dirname): bad = 0 try: names = os.listdir(dirname)

--- a/Tools/scripts/ftpmirror.py +++ b/Tools/scripts/ftpmirror.py @@ -108,7 +108,7 @@ def mirrorsubdir(f, localdir): if verbose: print('Creating local directory', repr(localdir)) try: makedir(localdir)

@@ -218,11 +218,11 @@ def mirrorsubdir(f, localdir): fp1.close() try: os.unlink(fullname)

@@ -255,7 +255,7 @@ def mirrorsubdir(f, localdir): try: if not localdir: names = os.listdir(os.curdir) else: names = os.listdir(localdir)

@@ -312,7 +312,7 @@ def remove(fullname): if os.path.isdir(fullname) and not os.path.islink(fullname): try: names = os.listdir(fullname)

@@ -322,13 +322,13 @@ def remove(fullname): return 0 try: os.rmdir(fullname)

--- a/Tools/scripts/linktree.py +++ b/Tools/scripts/linktree.py @@ -32,13 +32,13 @@ def main(): return 1 try: os.mkdir(newtree, 0o777)

@@ -51,7 +51,7 @@ def linknames(old, new, link): if debug: print('linknames', (old, new, link)) try: names = os.listdir(old)

--- a/Tools/scripts/pathfix.py +++ b/Tools/scripts/pathfix.py @@ -73,7 +73,7 @@ def recursedown(dirname): bad = 0 try: names = os.listdir(dirname)

--- a/Tools/scripts/pindent.py +++ b/Tools/scripts/pindent.py @@ -427,7 +427,7 @@ def complete_file(filename, stepsize = S # end if import os try: os.rename(filename, filename + '~')

--- a/Tools/scripts/treesync.py +++ b/Tools/scripts/treesync.py @@ -78,7 +78,7 @@ def process(slave, master): print("creating slave directory", slave) try: os.mkdir(slave)

--- a/Tools/scripts/untabify.py +++ b/Tools/scripts/untabify.py @@ -39,11 +39,11 @@ def process(filename, tabsize, verbose=T backup = filename + "~" try: os.unlink(backup)

--- a/Tools/scripts/which.py +++ b/Tools/scripts/which.py @@ -29,7 +29,7 @@ def main(): filename = os.path.join(dir, prog) try: st = os.stat(filename)