summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2008-08-20 12:55:31 (GMT)
committerBenjamin Peterson <benjamin@python.org>2008-08-20 12:55:31 (GMT)
commitb71caf186a7a3ccc5e3c6d5e23779ef6246ca1d2 (patch)
treeb5716606dfb232891cc6892458f911af96250baf
parent768008c6e2939d6bb6d275ba4f146e67bf7a6ab7 (diff)
downloadcpython-b71caf186a7a3ccc5e3c6d5e23779ef6246ca1d2.zip
cpython-b71caf186a7a3ccc5e3c6d5e23779ef6246ca1d2.tar.gz
cpython-b71caf186a7a3ccc5e3c6d5e23779ef6246ca1d2.tar.bz2
revert 65897
-rw-r--r--Doc/library/symtable.rst10
-rw-r--r--Lib/symtable.py6
-rw-r--r--Lib/test/test_symtable.py10
-rw-r--r--Misc/NEWS3
4 files changed, 13 insertions, 16 deletions
diff --git a/Doc/library/symtable.rst b/Doc/library/symtable.rst
index 4bb59e8..ee24823 100644
--- a/Doc/library/symtable.rst
+++ b/Doc/library/symtable.rst
@@ -95,19 +95,19 @@ Examining Symbol Tables
.. method:: get_parameters()
- Return a set containing names of parameters to this function.
+ Return a tuple containing names of parameters to this function.
.. method:: get_locals()
- Return a set containing names of locals in this function.
+ Return a tuple containing names of locals in this function.
.. method:: get_globals()
- Return a set containing names of globals in this function.
+ Return a tuple containing names of globals in this function.
.. method:: get_frees()
- Return a set containing names of free variables in this function.
+ Return a tuple containing names of free variables in this function.
.. class:: Class
@@ -116,7 +116,7 @@ Examining Symbol Tables
.. method:: get_methods()
- Return a set containing the names of methods declared in the class.
+ Return a tuple containing the names of methods declared in the class.
.. class:: Symbol
diff --git a/Lib/symtable.py b/Lib/symtable.py
index 9387a67..0d73870 100644
--- a/Lib/symtable.py
+++ b/Lib/symtable.py
@@ -128,8 +128,8 @@ class Function(SymbolTable):
__globals = None
def __idents_matching(self, test_func):
- return frozenset(ident for ident in self.get_identifiers()
- if test_func(self._table.symbols[ident]))
+ return tuple([ident for ident in self.get_identifiers()
+ if test_func(self._table.symbols[ident])])
def get_parameters(self):
if self.__params is None:
@@ -164,7 +164,7 @@ class Class(SymbolTable):
d = {}
for st in self._table.children:
d[st.name] = 1
- self.__methods = frozenset(d)
+ self.__methods = tuple(d)
return self.__methods
diff --git a/Lib/test/test_symtable.py b/Lib/test/test_symtable.py
index 712eca7..7e0206d 100644
--- a/Lib/test/test_symtable.py
+++ b/Lib/test/test_symtable.py
@@ -80,11 +80,11 @@ class SymtableTest(unittest.TestCase):
def test_function_info(self):
func = self.spam
- self.assertEqual(func.get_parameters(), {"a", "b", "kw", "var"})
+ self.assertEqual(func.get_parameters(), ("a", "b", "kw", "var"))
self.assertEqual(func.get_locals(),
- {"a", "b", "bar", "glob", "internal", "kw", "var", "x"})
- self.assertEqual(func.get_globals(), {"bar", "glob"})
- self.assertEqual(self.internal.get_frees(), {"x"})
+ ("a", "b", "bar", "glob", "internal", "kw", "var", "x"))
+ self.assertEqual(func.get_globals(), ("bar", "glob"))
+ self.assertEqual(self.internal.get_frees(), ("x",))
def test_globals(self):
self.assertTrue(self.spam.lookup("glob").is_global())
@@ -142,7 +142,7 @@ class SymtableTest(unittest.TestCase):
self.assertEqual(self.Mine.get_name(), "Mine")
def test_class_info(self):
- self.assertEqual(self.Mine.get_methods(), {'a_method'})
+ self.assertEqual(self.Mine.get_methods(), ('a_method',))
def test_filename_correct(self):
### Bug tickler: SyntaxError file name correct whether error raised
diff --git a/Misc/NEWS b/Misc/NEWS
index 096f9a1..3d10f6e 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -249,9 +249,6 @@ Extension Modules
Library
-------
-- symtable.Function's ``get_locals()``, ``get_globals()``, ``get_parameters()``,
- and ``get_frees()`` and symtable.Class's ``get_methods()`` now return sets.
-
- The methods ``is_in_tuple()``, ``is_vararg()``, and ``is_keywordarg()`` of
symtable.Symbol have been removed.