diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2019-12-02 20:15:32 -0500 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2019-12-02 20:15:32 -0500 |
commit | ae25eefbf48b9e6897af37903ecd697eb19f337f (patch) | |
tree | b48181eec86e85df4d7dc5e3a72af7acf508d797 /coverage/inorout.py | |
parent | 6bda7308644a65860f8e834a6be7fa3e267d9d8d (diff) | |
download | python-coveragepy-git-ae25eefbf48b9e6897af37903ecd697eb19f337f.tar.gz |
A helper to get code objects
Diffstat (limited to 'coverage/inorout.py')
-rw-r--r-- | coverage/inorout.py | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/coverage/inorout.py b/coverage/inorout.py index 2a19ba69..0eea62ae 100644 --- a/coverage/inorout.py +++ b/coverage/inorout.py @@ -14,6 +14,7 @@ import sys import traceback from coverage import env +from coverage.backward import code_object from coverage.disposition import FileDisposition, disposition_init from coverage.files import TreeMatcher, FnmatchMatcher, ModuleMatcher from coverage.files import prep_patterns, find_python_files, canonical_filename @@ -157,11 +158,7 @@ class InOrOut(object): # objects still have the file names. So dig into one to find # the path to exclude. The "filename" might be synthetic, # don't be fooled by those. - structseq_new = _structseq.structseq_new - try: - structseq_file = structseq_new.func_code.co_filename - except AttributeError: - structseq_file = structseq_new.__code__.co_filename + structseq_file = code_object(_structseq.structseq_new).co_filename if not structseq_file.startswith("<"): self.pylib_paths.add(canonical_path(structseq_file)) |