summaryrefslogtreecommitdiffstats
path: root/Lib/tarfile.py
diff options
context:
space:
mode:
authorBrett Cannon <brett@python.org>2013-07-04 21:43:24 (GMT)
committerBrett Cannon <brett@python.org>2013-07-04 21:43:24 (GMT)
commitcd171c8e92c10d327151400fd8f16b11a4964615 (patch)
treedb734100511572201a54a6b7ce1803bcea4c94da /Lib/tarfile.py
parentfff59155d40ede93594eb77f320e0bde658cce28 (diff)
downloadcpython-cd171c8e92c10d327151400fd8f16b11a4964615.zip
cpython-cd171c8e92c10d327151400fd8f16b11a4964615.tar.gz
cpython-cd171c8e92c10d327151400fd8f16b11a4964615.tar.bz2
Issue #18200: Back out usage of ModuleNotFoundError (8d28d44f3a9a)
Diffstat (limited to 'Lib/tarfile.py')
-rw-r--r--Lib/tarfile.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/Lib/tarfile.py b/Lib/tarfile.py
index 289aefd..06df7df 100644
--- a/Lib/tarfile.py
+++ b/Lib/tarfile.py
@@ -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)