diff options
author | Buck Golemon <buck@yelp.com> | 2014-11-14 16:33:41 -0800 |
---|---|---|
committer | Buck Golemon <buck@yelp.com> | 2014-11-14 16:33:41 -0800 |
commit | 0166806295cdfcc525534d25e331e1f9852cbd5f (patch) | |
tree | 4352de9fbd3c36cf85f3b693fdf4df564deaafc2 /coverage/control.py | |
parent | eafbacf36a5ab26e44666c8477f7fdc0284bd068 (diff) | |
download | python-coveragepy-0166806295cdfcc525534d25e331e1f9852cbd5f.tar.gz |
they changed the way __loader__ looks in 3.3
Diffstat (limited to 'coverage/control.py')
-rw-r--r-- | coverage/control.py | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/coverage/control.py b/coverage/control.py index 47e5b50..7a85103 100644 --- a/coverage/control.py +++ b/coverage/control.py @@ -322,9 +322,14 @@ class Coverage(object): return dunder_name loader = module_namespace.get('__loader__', None) - if hasattr(loader, 'fullname') and isinstance(loader.fullname, str): - # module loaded via runpy -m - return loader.fullname + for attrname in ('fullname', 'name'): # attribute renamed in py3.2 + if ( + hasattr(loader, 'fullname') and + isinstance(loader.fullname, str) and + loader.fullname != '__main__' + ): + # module loaded via runpy -m + return loader.fullname # script as first argument to python cli inspectedname = inspect.getmodulename(filename) |