Skip to content

Commit 17072bd

Browse files
committed
symtable fix 3
1 parent 2175829 commit 17072bd

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

Lib/symtable.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,11 @@ def get_children(self):
171171
return [_newSymbolTable(st, self._filename)
172172
for st in self._table.children]
173173

174+
def get_cells(self):
175+
"""Return a list of cell variable names in the table."""
176+
return [s.get_name() for s in self.get_symbols() if s.is_cell()]
177+
178+
174179

175180
def _get_scope(flags): # like _PyST_GetScope()
176181
return (flags >> SCOPE_OFF) & SCOPE_MASK
@@ -230,13 +235,6 @@ def get_frees(self):
230235
self.__frees = self.__idents_matching(is_free)
231236
return self.__frees
232237

233-
def get_cells(self):
234-
"""Return a tuple of cells in the function."""
235-
if self.__cells is None:
236-
is_cell = lambda x: _get_scope(x) == CELL
237-
self.__cells = self.__idents_matching(is_cell)
238-
return self.__cells
239-
240238

241239
class Class(SymbolTable):
242240

0 commit comments

Comments
 (0)