Skip to content

Commit cf1dec0

Browse files
committed
refactor: these pypy modules are available in all our versions
1 parent a876052 commit cf1dec0

File tree

1 file changed

+7
-15
lines changed

1 file changed

+7
-15
lines changed

coverage/inorout.py

+7-15
Original file line numberDiff line numberDiff line change
@@ -36,26 +36,18 @@
3636
from coverage.plugin_support import Plugins
3737

3838

39-
# Pypy has some unusual stuff in the "stdlib". Consider those locations
40-
# when deciding where the stdlib is. These modules are not used for anything,
41-
# they are modules importable from the pypy lib directories, so that we can
42-
# find those directories.
4339
modules_we_happen_to_have: list[ModuleType] = [
4440
inspect, itertools, os, platform, re, sysconfig, traceback,
4541
]
4642

4743
if env.PYPY:
48-
try:
49-
import _structseq
50-
modules_we_happen_to_have.append(_structseq)
51-
except ImportError:
52-
pass
53-
54-
try:
55-
import _pypy_irc_topic
56-
modules_we_happen_to_have.append(_pypy_irc_topic)
57-
except ImportError:
58-
pass
44+
# Pypy has some unusual stuff in the "stdlib". Consider those locations
45+
# when deciding where the stdlib is. These modules are not used for anything,
46+
# they are modules importable from the pypy lib directories, so that we can
47+
# find those directories.
48+
import _pypy_irc_topic # pylint: disable=import-error
49+
import _structseq # pylint: disable=import-error
50+
modules_we_happen_to_have.extend([_structseq, _pypy_irc_topic])
5951

6052

6153
os = isolate_module(os)

0 commit comments

Comments
 (0)