Skip to content

Add co_cellvars to code object #4501

Closed

Description

@DimitrisJim

Opening this separately from #1838 since it seems like a good first issue.

Currently, code objects are missing the co_cellvars attribute:

def foo(a, b):
    def bar(c, d):
        print(a, b, c, d)

In RustPython:

>>>>> foo.__code__.co_cellvars
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'code' object has no attribute 'co_cellvars'

While in Python:

>>> foo.__code__.co_cellvars
('a', 'b')

looking at the other methods on PyCode should help, the implementation should be similar to others there that return a tuple.

Activity

  1. added a commit that references this issue on Feb 15, 2023
    529d223
  2. added a commit that references this issue on Feb 19, 2023
    c5a629b
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

    C-compatA discrepancy between RustPython and CPythongood first issueGood for newcomers

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions