summaryrefslogtreecommitdiff
path: root/Lib/test/test_inspect.py
diff options
context:
space:
mode:
authorPhillip J. Eby <pje@telecommunity.com>2006-07-10 19:03:29 +0000
committerPhillip J. Eby <pje@telecommunity.com>2006-07-10 19:03:29 +0000
commit5d86bdb3aebb14228d3c2e3f921bda34cf1c886c (patch)
tree5e32d611476977d706a4c7057d01f0a21d5e24ed /Lib/test/test_inspect.py
parentb9cb84fe969d86c9d20882570e9256e6fff47436 (diff)
downloadcpython-git-5d86bdb3aebb14228d3c2e3f921bda34cf1c886c.tar.gz
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.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/Lib/test/test_inspect.py b/Lib/test/test_inspect.py
index 62c40eba4d..d100d22ab5 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