diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2014-10-28 09:24:33 -0400 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2014-10-28 09:24:33 -0400 |
commit | ff22f3bda01cde32b8dab56997afd02445c1c583 (patch) | |
tree | debdae87c04c35c3966b75b12fbc0b7ab7a8f8c8 /coverage/execfile.py | |
parent | a0f2211ea7f0766516ba2a3f3f99c1a3fd1c0e9d (diff) | |
download | python-coveragepy-git-ff22f3bda01cde32b8dab56997afd02445c1c583.tar.gz |
Fix a weird PyPy3 problem with a weird PyPy3 fix.
Diffstat (limited to 'coverage/execfile.py')
-rw-r--r-- | coverage/execfile.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/coverage/execfile.py b/coverage/execfile.py index b7877b6a..82cc2217 100644 --- a/coverage/execfile.py +++ b/coverage/execfile.py @@ -138,6 +138,13 @@ def run_python_file(filename, args, package=None): # so that the coverage.py code doesn't appear in the final printed # traceback. typ, err, tb = sys.exc_info() + + # PyPy3 weirdness. If I don't access __context__, then somehow it + # is non-None when the exception is reported at the upper layer, + # and a nested exception is shown to the user. This getattr fixes + # it somehow? https://bitbucket.org/pypy/pypy/issue/1903 + getattr(err, '__context__', None) + raise ExceptionDuringRun(typ, err, tb.tb_next) finally: # Restore the old __main__ |