diff --git a/CHANGES.rst b/CHANGES.rst index 6d6e0dda5..4bd766da0 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -10,6 +10,14 @@ CHANGES not explicitly set in the environment. Fixes `#135 `_. +* Bug fix: Since `69649c1 `_ we have been unpatching + the side-effects of ``sys.modules`` after ``PEX.execute``. This takes all modules imported during + the PEX lifecycle and sets all their attributes to ``None``. Unfortunately, ``sys.excepthook``, + ``atexit`` and ``__del__`` may still try to operate using these tainted modules, causing exceptions + on interpreter teardown. This reverts just the ``sys`` unpatching so that the abovementioned + teardown hooks behave more predictably. + Fixes `#141 `_. + ----- 1.0.1 ----- diff --git a/pex/pex.py b/pex/pex.py index b9e86021b..2744bb61d 100644 --- a/pex/pex.py +++ b/pex/pex.py @@ -243,11 +243,7 @@ def patch_all(path, path_importer_cache, modules): new_sys_path, new_sys_path_importer_cache, new_sys_modules = cls.minimum_sys() patch_all(new_sys_path, new_sys_path_importer_cache, new_sys_modules) - - try: - yield - finally: - patch_all(old_sys_path, old_sys_path_importer_cache, old_sys_modules) + yield def _wrap_coverage(self, runner, *args): if not self._vars.PEX_COVERAGE and self._vars.PEX_COVERAGE_FILENAME is None: diff --git a/pex/version.py b/pex/version.py index 342aff87f..46818e3b4 100644 --- a/pex/version.py +++ b/pex/version.py @@ -1,7 +1,7 @@ # Copyright 2015 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). -__version__ = '1.0.1' +__version__ = '1.0.2.dev0' SETUPTOOLS_REQUIREMENT = 'setuptools>=2.2,<16' WHEEL_REQUIREMENT = 'wheel>=0.24.0,<0.25.0'