diff options
author | Phillip J. Eby <pje@telecommunity.com> | 2006-07-10 19:03:29 (GMT) |
---|---|---|
committer | Phillip J. Eby <pje@telecommunity.com> | 2006-07-10 19:03:29 (GMT) |
commit | 5d86bdb3aebb14228d3c2e3f921bda34cf1c886c (patch) | |
tree | 5e32d611476977d706a4c7057d01f0a21d5e24ed /Lib/test/test_inspect.py | |
parent | b9cb84fe969d86c9d20882570e9256e6fff47436 (diff) | |
download | cpython-5d86bdb3aebb14228d3c2e3f921bda34cf1c886c.zip cpython-5d86bdb3aebb14228d3c2e3f921bda34cf1c886c.tar.gz cpython-5d86bdb3aebb14228d3c2e3f921bda34cf1c886c.tar.bz2 |
Fix SF#1516184 and add a test to prevent regression.
Diffstat (limited to 'Lib/test/test_inspect.py')
-rw-r--r-- | Lib/test/test_inspect.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/Lib/test/test_inspect.py b/Lib/test/test_inspect.py index 62c40eb..d100d22 100644 --- a/Lib/test/test_inspect.py +++ b/Lib/test/test_inspect.py @@ -178,6 +178,16 @@ class TestRetrievingSourceCode(GetSourceBase): def test_getfile(self): self.assertEqual(inspect.getfile(mod.StupidGit), mod.__file__) + def test_getmodule_recursion(self): + from new import module + name = '__inspect_dummy' + m = sys.modules[name] = module(name) + m.__file__ = "<string>" # hopefully not a real filename... + m.__loader__ = "dummy" # pretend the filename is understood by a loader + exec "def x(): pass" in m.__dict__ + self.assertEqual(inspect.getsourcefile(m.x.func_code), '<string>') + del sys.modules[name] + class TestDecorators(GetSourceBase): fodderFile = mod2 |