summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_compile.py
diff options
context:
space:
mode:
authorJeremy Hylton <jeremy@alum.mit.edu>2007-02-27 01:01:59 (GMT)
committerJeremy Hylton <jeremy@alum.mit.edu>2007-02-27 01:01:59 (GMT)
commit37075c5acee9d25b1d0a8e8a945964a5c0c9b1e1 (patch)
tree6eb8ff72a357da9010878e003cc8404267fc0689 /Lib/test/test_compile.py
parentc6a1ef3fe15632e4476a70d80ad4bb5f61dd5953 (diff)
downloadcpython-37075c5acee9d25b1d0a8e8a945964a5c0c9b1e1.zip
cpython-37075c5acee9d25b1d0a8e8a945964a5c0c9b1e1.tar.gz
cpython-37075c5acee9d25b1d0a8e8a945964a5c0c9b1e1.tar.bz2
Fix long-standing bug in name mangling for package imports
Reported by Mike Verdone.
Diffstat (limited to 'Lib/test/test_compile.py')
-rw-r--r--Lib/test/test_compile.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/Lib/test/test_compile.py b/Lib/test/test_compile.py
index 4cb619d..d1b6d8c 100644
--- a/Lib/test/test_compile.py
+++ b/Lib/test/test_compile.py
@@ -394,6 +394,19 @@ if 1:
del d[..., ...]
self.assertEqual((Ellipsis, Ellipsis) in d, False)
+ def test_mangling(self):
+ class A:
+ def f():
+ __mangled = 1
+ __not_mangled__ = 2
+ import __mangled_mod
+ import __package__.module
+
+ self.assert_("_A__mangled" in A.f.func_code.co_varnames)
+ self.assert_("__not_mangled__" in A.f.func_code.co_varnames)
+ self.assert_("_A__mangled_mod" in A.f.func_code.co_varnames)
+ self.assert_("__package__" in A.f.func_code.co_varnames)
+
def test_main():
test_support.run_unittest(TestSpecifics)