[Python-checkins] r85562 - in python/branches/py3k: Lib/test/test_scope.py Misc/NEWS Python/symtable.c
benjamin.peterson
python-checkins at python.org
Sat Oct 16 05:45:45 CEST 2010
Author: benjamin.peterson
Date: Sat Oct 16 05:45:45 2010
New Revision: 85562
Log:
don't identify the toplevel namespace by name #9997
Modified:
python/branches/py3k/Lib/test/test_scope.py
python/branches/py3k/Misc/NEWS
python/branches/py3k/Python/symtable.c
Modified: python/branches/py3k/Lib/test/test_scope.py
==============================================================================
--- python/branches/py3k/Lib/test/test_scope.py (original)
+++ python/branches/py3k/Lib/test/test_scope.py Sat Oct 16 05:45:45 2010
@@ -705,6 +705,14 @@
h = g()
self.assertEqual(h(), 3)
+ def testTopIsNotSignificant(self):
+ # See #9997.
+ def top(a):
+ pass
+ def b():
+ global a
+
+
def test_main():
run_unittest(ScopeTests)
Modified: python/branches/py3k/Misc/NEWS
==============================================================================
--- python/branches/py3k/Misc/NEWS (original)
+++ python/branches/py3k/Misc/NEWS Sat Oct 16 05:45:45 2010
@@ -10,6 +10,9 @@
Core and Builtins
-----------------
+- Issue #9997: Don't let the name "top" have special significance in scope
+ resolution.
+
- Issue #9862: Compensate for broken PIPE_BUF in AIX by hard coding
its value as the default 512 when compiling on AIX.
Modified: python/branches/py3k/Python/symtable.c
==============================================================================
--- python/branches/py3k/Python/symtable.c (original)
+++ python/branches/py3k/Python/symtable.c Sat Oct 16 05:45:45 2010
@@ -924,7 +924,7 @@
st->st_cur = ste_new(st, name, block, ast, lineno, col_offset);
if (st->st_cur == NULL)
return 0;
- if (name == GET_IDENTIFIER(top))
+ if (block == ModuleBlock)
st->st_global = st->st_cur->ste_symbols;
if (prev) {
if (PyList_Append(prev->ste_children,
More information about the Python-checkins
mailing list