Skip to content

Commit a1ebb69

Browse files
committed
symtable fix 9
1 parent d36cd84 commit a1ebb69

3 files changed

Lines changed: 13 additions & 0 deletions

File tree

Doc/library/symtable.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,10 @@ Examining Symbol Tables
180180
Return a tuple containing names of :term:`free (closure) variables <closure variable>`
181181
in this function.
182182

183+
.. method:: get_cells()
184+
185+
Return a tuple containing the names of cell variables in this table.
186+
183187

184188
.. class:: Class
185189

@@ -353,6 +357,12 @@ Examining Symbol Tables
353357
Return the namespace bound to this name. If more than one or no namespace
354358
is bound to this name, a :exc:`ValueError` is raised.
355359

360+
.. method:: is_cell()
361+
362+
Return ``True`` if the symbol is a cell variable.
363+
364+
.. versionadded:: 3.15
365+
356366

357367
.. _symtable-cli:
358368

Lib/test/test_symtable.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,7 @@ def test_function_info(self):
255255
self.assertEqual(sorted(func.get_locals()), expected)
256256
self.assertEqual(sorted(func.get_globals()), ["bar", "glob", "some_assigned_global_var"])
257257
self.assertEqual(self.internal.get_frees(), ("x",))
258+
self.assertEqual(self.spam.get_cells(), ("some_var", "x",))
258259

259260
def test_globals(self):
260261
self.assertTrue(self.spam.lookup("glob").is_global())
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Add :meth:`symtable.SymbolTable.get_cells` and
2+
:meth:`symtable.Symbol.is_cell` methods.

0 commit comments

Comments
 (0)