Skip to content

Add co_cellvars to code object #4501

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
DimitrisJim opened this issue Feb 14, 2023 · 0 comments · Fixed by #4507
Closed

Add co_cellvars to code object #4501

DimitrisJim opened this issue Feb 14, 2023 · 0 comments · Fixed by #4507
Labels
C-compat A discrepancy between RustPython and CPython good first issue Good for newcomers

Comments

@DimitrisJim
Copy link
Member

DimitrisJim commented Feb 14, 2023

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.

@DimitrisJim DimitrisJim added good first issue Good for newcomers C-compat A discrepancy between RustPython and CPython labels Feb 14, 2023
howjmay added a commit to howjmay/RustPython that referenced this issue Feb 15, 2023
itsankitkp pushed a commit to itsankitkp/RustPython that referenced this issue Feb 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-compat A discrepancy between RustPython and CPython good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant