Karthikeyan Singaravelan <tir.kar...@gmail.com> added the comment: The failing test was added with d4c76d960b8b286b75c933780416ace9cda682fd
commit d4c76d960b8b286b75c933780416ace9cda682fd Author: INADA Naoki <meth...@users.noreply.github.com> Date: Mon Oct 1 21:10:37 2018 +0900 bpo-30167: Add test for module.__cached__ is None (GH-7617) diff --git a/Lib/test/test_site.py b/Lib/test/test_site.py index dc59e5917c..33a8f1a44c 100644 --- a/Lib/test/test_site.py +++ b/Lib/test/test_site.py @@ -389,6 +389,17 @@ class ImportSideEffectTests(unittest.TestCase): "expected absolute path, got {}" .format(os__cached__.decode('ascii'))) + def test_abs_paths_cached_None(self): + """Test for __cached__ is None. + + Regarding to PEP 3147, __cached__ can be None. + + See also: https://bugs.python.org/issue30167 + """ + sys.modules['test'].__cached__ = None + site.abs_paths() + self.assertIsNone(sys.modules['test'].__cached__) + # Latest master ➜ cpython git:(master) ./python.exe -m test.regrtest test_inspect test_site Run tests sequentially 0:00:00 load avg: 1.75 [1/2] test_inspect 0:00:02 load avg: 1.75 [2/2] test_site test test_site failed -- Traceback (most recent call last): File "/Users/karthikeyansingaravelan/stuff/python/cpython/Lib/test/test_site.py", line 400, in test_abs_paths_cached_None site.abs_paths() File "/Users/karthikeyansingaravelan/stuff/python/cpython/Lib/site.py", line 101, in abs_paths for m in set(sys.modules.values()): TypeError: unhashable type: 'dict' test_site failed == Tests result: FAILURE == 1 test OK. 1 test failed: test_site Total duration: 2 sec 868 ms Tests result: FAILURE ➜ cpython git:(master) git checkout d4c76d960b8b286b75c933780416ace9cda682fd~1 Lib/test/test_site.py ➜ cpython git:(master) ✗ ./python.exe -m test.regrtest test_inspect test_site Run tests sequentially 0:00:00 load avg: 1.49 [1/2] test_inspect 0:00:02 load avg: 1.49 [2/2] test_site == Tests result: SUCCESS == All 2 tests OK. Total duration: 2 sec 848 ms Tests result: SUCCESS Adding INADA Naoki for thoughts. Thanks ---------- nosy: +inada.naoki _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue34871> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com