python / python/cpython

expose CELL status of a symbol in symtable

Open
#143,504 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

stdlib type-feature
Dominant language
Python
Stars
77.2k
Forks
35.9k
PR merge metrics
PR metrics pending

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
  • gh-143549

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the symtable Symbol predicates listed in the issue and inspect how the symbol reports its internal CELL scope. The issue links PR gh-143549, so review that work first. Done means the CELL status is exposed through the symtable API consistently with the existing predicates.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
compilers
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.