summaryrefslogtreecommitdiff
path: root/coverage/control.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2016-08-03 13:03:01 -0400
committerNed Batchelder <ned@nedbatchelder.com>2016-08-03 13:03:01 -0400
commit90ecf09e3fc3f9c8950deba71fca699c7623edbf (patch)
treefe0be805116ffb62ad359fe272fe03cc503ba572 /coverage/control.py
parentde35946f2db5ad862fe2bd7f89573a038b156a82 (diff)
downloadpython-coveragepy-git-90ecf09e3fc3f9c8950deba71fca699c7623edbf.tar.gz
Add support for PyPy3 5.2 alpha 1
Diffstat (limited to 'coverage/control.py')
-rw-r--r--coverage/control.py22
1 files changed, 16 insertions, 6 deletions
diff --git a/coverage/control.py b/coverage/control.py
index 56a6afd6..16e9748a 100644
--- a/coverage/control.py
+++ b/coverage/control.py
@@ -35,11 +35,20 @@ from coverage.xmlreport import XmlReporter
os = isolate_module(os)
# Pypy has some unusual stuff in the "stdlib". Consider those locations
-# when deciding where the stdlib is.
-try:
- import _structseq
-except ImportError:
- _structseq = None
+# when deciding where the stdlib is. This modules are not used for anything,
+# they are modules importable from the pypy lib directories, so that we can
+# find those directories.
+_structseq = _pypy_irc_topic = None
+if env.PYPY:
+ try:
+ import _structseq
+ except ImportError:
+ pass
+
+ try:
+ import _pypy_irc_topic
+ except ImportError:
+ pass
class Coverage(object):
@@ -308,9 +317,10 @@ class Coverage(object):
# environments (virtualenv, for example), these modules may be
# spread across a few locations. Look at all the candidate modules
# we've imported, and take all the different ones.
- for m in (atexit, inspect, os, platform, re, _structseq, traceback):
+ for m in (atexit, inspect, os, platform, _pypy_irc_topic, re, _structseq, traceback):
if m is not None and hasattr(m, "__file__"):
self.pylib_dirs.add(self._canonical_dir(m))
+
if _structseq and not hasattr(_structseq, '__file__'):
# PyPy 2.4 has no __file__ in the builtin modules, but the code
# objects still have the file names. So dig into one to find