Skip to content

Commit b71caf1

Browse files
committed
revert 65897
1 parent 768008c commit b71caf1

4 files changed

Lines changed: 13 additions & 16 deletions

File tree

Doc/library/symtable.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -95,19 +95,19 @@ Examining Symbol Tables
9595

9696
.. method:: get_parameters()
9797

98-
Return a set containing names of parameters to this function.
98+
Return a tuple containing names of parameters to this function.
9999

100100
.. method:: get_locals()
101101

102-
Return a set containing names of locals in this function.
102+
Return a tuple containing names of locals in this function.
103103

104104
.. method:: get_globals()
105105

106-
Return a set containing names of globals in this function.
106+
Return a tuple containing names of globals in this function.
107107

108108
.. method:: get_frees()
109109

110-
Return a set containing names of free variables in this function.
110+
Return a tuple containing names of free variables in this function.
111111

112112

113113
.. class:: Class
@@ -116,7 +116,7 @@ Examining Symbol Tables
116116

117117
.. method:: get_methods()
118118

119-
Return a set containing the names of methods declared in the class.
119+
Return a tuple containing the names of methods declared in the class.
120120

121121

122122
.. class:: Symbol

Lib/symtable.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,8 @@ class Function(SymbolTable):
128128
__globals = None
129129

130130
def __idents_matching(self, test_func):
131-
return frozenset(ident for ident in self.get_identifiers()
132-
if test_func(self._table.symbols[ident]))
131+
return tuple([ident for ident in self.get_identifiers()
132+
if test_func(self._table.symbols[ident])])
133133

134134
def get_parameters(self):
135135
if self.__params is None:
@@ -164,7 +164,7 @@ def get_methods(self):
164164
d = {}
165165
for st in self._table.children:
166166
d[st.name] = 1
167-
self.__methods = frozenset(d)
167+
self.__methods = tuple(d)
168168
return self.__methods
169169

170170

Lib/test/test_symtable.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,11 @@ def test_lineno(self):
8080

8181
def test_function_info(self):
8282
func = self.spam
83-
self.assertEqual(func.get_parameters(), {"a", "b", "kw", "var"})
83+
self.assertEqual(func.get_parameters(), ("a", "b", "kw", "var"))
8484
self.assertEqual(func.get_locals(),
85-
{"a", "b", "bar", "glob", "internal", "kw", "var", "x"})
86-
self.assertEqual(func.get_globals(), {"bar", "glob"})
87-
self.assertEqual(self.internal.get_frees(), {"x"})
85+
("a", "b", "bar", "glob", "internal", "kw", "var", "x"))
86+
self.assertEqual(func.get_globals(), ("bar", "glob"))
87+
self.assertEqual(self.internal.get_frees(), ("x",))
8888

8989
def test_globals(self):
9090
self.assertTrue(self.spam.lookup("glob").is_global())
@@ -142,7 +142,7 @@ def test_name(self):
142142
self.assertEqual(self.Mine.get_name(), "Mine")
143143

144144
def test_class_info(self):
145-
self.assertEqual(self.Mine.get_methods(), {'a_method'})
145+
self.assertEqual(self.Mine.get_methods(), ('a_method',))
146146

147147
def test_filename_correct(self):
148148
### Bug tickler: SyntaxError file name correct whether error raised

Misc/NEWS

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -249,9 +249,6 @@ Extension Modules
249249
Library
250250
-------
251251

252-
- symtable.Function's ``get_locals()``, ``get_globals()``, ``get_parameters()``,
253-
and ``get_frees()`` and symtable.Class's ``get_methods()`` now return sets.
254-
255252
- The methods ``is_in_tuple()``, ``is_vararg()``, and ``is_keywordarg()`` of
256253
symtable.Symbol have been removed.
257254

0 commit comments

Comments
 (0)