FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

expose CELL status of a symbol in symtable · Issue #143504 · python/cpython · GitHub

Repository navigation

expose CELL status of a symbol in symtable #143504

Open

Description

Feature or enhancement

Proposal:

symtable symbols have the following predicates, but for some reason no is_cell. Is there a reason for this, or should we expose is_cell as well?

'is_annotated', 'is_assigned', 'is_declared_global', 'is_free', 'is_global', 'is_imported', 'is_local', 'is_namespace', 'is_nonlocal', 'is_parameter', 'is_referenced'

The symbol obviously knows whether it's a cell:

>>> st.get_children()[0].get_symbols()[0]._scope_str
<bound method Symbol._scope_str of <symbol 'x': CELL, USE|DEF_LOCAL>>

Has this already been discussed elsewhere?

No response given

Links to previous discussion of this feature:

No response

Linked PRs

Activity

  1. added
    stdlibStandard Library Python modules in the Lib/ directory
    on Jan 7, 2026
  2. Yashp002 commented on Jan 7, 2026

    Contributor

    I did look this up in the issue tracker, python-dev/python-ideas archives, and discuss.python.org for symtable is_cell and it doesn't seem have to been discussed elsewhere.

  3. picnixz commented on Jan 7, 2026

    Member

    @Yashp002 Core developers usually don't need to discuss some features. We appreciate your dedication to contribute but please let triagers or core devs decide whether an issue should be kept open or not. In this case, it's not even about exposing it but rather asking for something.

    symtable symbols have the following predicates, but for some reason no is_cell. Is there a reason for this, or should we expose is_cell as well?

    I'm pretty sure I asked this question myself when I worked on #120029 but I didn't follow up. I think we can add it for completeness as it's not really costly and that's the only way to know whether something is in a CELL scope or not (scope being private and scope_str being a string, hence unstable).

  4. Yashp002 commented on Jan 7, 2026

    Contributor

    I can put together a PR to add is_cell to symtable then, since it sounds like a straightforward addition for completeness.
    Also was not my intention to be prying into a core dev's authority, that's my bad.

  5. iritkatriel commented on Jan 7, 2026

    MemberAuthor

    Thanks. Also maybe a get_cells to go with the existing get_frees.

  6. Yashp002 commented on Jan 21, 2026

    Contributor

    @iritkatriel Could you verify my PR, I've added get_cells, is_cell and also the test_cells in test_symtable.py for the build.
    Please let me know If I have to further fix anything:D

  7. added a commit that references this issue on Jan 25, 2026
  8. added a commit that references this issue on Feb 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    stdlibStandard Library Python modules in the Lib/ directorytype-featureA feature request or enhancement

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


    Back | FazBrowse Home | New Git URL