summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2009-06-13 03:46:30 (GMT)
committerBenjamin Peterson <benjamin@python.org>2009-06-13 03:46:30 (GMT)
commit565e1b6bb724af71f439ec914b34f74e5163fe3d (patch)
treeb70c61a6837b289a61762360c9ae90eb901377e0 /Lib
parent4afbba3d340655bb8be2a97b76fe689be7f0c013 (diff)
downloadcpython-565e1b6bb724af71f439ec914b34f74e5163fe3d.zip
cpython-565e1b6bb724af71f439ec914b34f74e5163fe3d.tar.gz
cpython-565e1b6bb724af71f439ec914b34f74e5163fe3d.tar.bz2
prevent import statements from assigning to None
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_compile.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/Lib/test/test_compile.py b/Lib/test/test_compile.py
index 78215d2..4e15d8c 100644
--- a/Lib/test/test_compile.py
+++ b/Lib/test/test_compile.py
@@ -270,11 +270,17 @@ if 1:
'(a, None) = 0, 0',
'for None in range(10): pass',
'def f(None): pass',
+ 'import None',
+ 'import x as None',
+ 'from x import None',
+ 'from x import y as None'
]
for stmt in stmts:
stmt += "\n"
self.assertRaises(SyntaxError, compile, stmt, 'tmp', 'single')
self.assertRaises(SyntaxError, compile, stmt, 'tmp', 'exec')
+ # This is ok.
+ compile("from None import x", "tmp", "exec")
def test_import(self):
succeed = [