]> granicus.if.org Git - python/commitdiff
revert 65897
authorBenjamin Peterson <benjamin@python.org>
Wed, 20 Aug 2008 12:55:31 +0000 (12:55 +0000)
committerBenjamin Peterson <benjamin@python.org>
Wed, 20 Aug 2008 12:55:31 +0000 (12:55 +0000)
Doc/library/symtable.rst
Lib/symtable.py
Lib/test/test_symtable.py
Misc/NEWS

index 4bb59e87f7caed688778109c463391ce16d317cc..ee2482377decf39725a55cee727de85366e8c8fd 100644 (file)
@@ -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
index 9387a67e24285dced61f5885aee7f88e3f257fc9..0d738707095e10c3404c8e3b00414c3ceac07a5c 100644 (file)
@@ -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
 
 
index 712eca7189a654343b96343aaf9880ee46b39e61..7e0206d719102091ba0762a8a09f9d48638cd930 100644 (file)
@@ -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
index 096f9a104763ecc6ccc95132cddc1d8a0482aa2a..3d10f6ee55cac8927e11f0d4998b9c17c970f0ca 100644 (file)
--- 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.