Issue #18200: Back out usage of ModuleNotFoundError (8d28d44f3a9a)

This commit is contained in:
Brett Cannon 2013-07-04 17:43:24 -04:00
parent fff59155d4
commit cd171c8e92
83 changed files with 158 additions and 144 deletions

View file

@ -50,7 +50,7 @@ import re
try:
import grp, pwd
except ModuleNotFoundError:
except ImportError:
grp = pwd = None
# os.symlink on Windows prior to 6.0 raises NotImplementedError
@ -381,7 +381,7 @@ class _Stream:
if comptype == "gz":
try:
import zlib
except ModuleNotFoundError:
except ImportError:
raise CompressionError("zlib module is not available")
self.zlib = zlib
self.crc = zlib.crc32(b"")
@ -394,7 +394,7 @@ class _Stream:
elif comptype == "bz2":
try:
import bz2
except ModuleNotFoundError:
except ImportError:
raise CompressionError("bz2 module is not available")
if mode == "r":
self.dbuf = b""
@ -406,7 +406,7 @@ class _Stream:
elif comptype == "xz":
try:
import lzma
except ModuleNotFoundError:
except ImportError:
raise CompressionError("lzma module is not available")
if mode == "r":
self.dbuf = b""
@ -1654,7 +1654,7 @@ class TarFile(object):
try:
import bz2
except ModuleNotFoundError:
except ImportError:
raise CompressionError("bz2 module is not available")
fileobj = bz2.BZ2File(fileobj or name, mode,
@ -1678,7 +1678,7 @@ class TarFile(object):
try:
import lzma
except ModuleNotFoundError:
except ImportError:
raise CompressionError("lzma module is not available")
fileobj = lzma.LZMAFile(fileobj or name, mode, preset=preset)