Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions Doc/library/symtable.rst
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,10 @@ Examining Symbol Tables
Return a tuple containing names of :term:`free (closure) variables <closure variable>`
in this function.

.. method:: get_cells()
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add the versionadded directive as well


Return a tuple containing the names of cell variables in this table.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

try formatting like the entry for get_frees with :term:



.. class:: Class

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

.. method:: is_cell()

Return ``True`` if the symbol is a cell variable.

.. versionadded:: 3.15
Copy link
Copy Markdown
Member

@iritkatriel iritkatriel Jan 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's put this next to is_free.



.. _symtable-cli:

Expand Down
1 change: 1 addition & 0 deletions Lib/test/test_symtable.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@ def test_function_info(self):
self.assertEqual(sorted(func.get_locals()), expected)
self.assertEqual(sorted(func.get_globals()), ["bar", "glob", "some_assigned_global_var"])
self.assertEqual(self.internal.get_frees(), ("x",))
self.assertEqual(self.spam.get_cells(), ("some_var", "x",))

def test_globals(self):
self.assertTrue(self.spam.lookup("glob").is_global())
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Add :meth:`symtable.SymbolTable.get_cells` and
:meth:`symtable.Symbol.is_cell` methods.
Comment thread
iritkatriel marked this conversation as resolved.
Outdated
Loading