Opening this separately from #1838 since it also seems like a good first issue.
Currently, code objects are missing the co_freevars attribute:
In RustPython:
>>>>> foo.__code__.co_nlocals
AttributeError: 'code' object has no attribute 'co_nlocals'
While in Python:
>>> foo.__code__.co_nlocals
3
looking at the other methods on PyCode should help, the implementation should be similar to others there.
As the linked issue states, this does indeed appear to be len(self.varnames) (see this invariant in the CPython source)
Opening this separately from #1838 since it also seems like a good first issue.
Currently, code objects are missing the
co_freevarsattribute:In RustPython:
While in Python:
looking at the other methods on
PyCodeshould help, the implementation should be similar to others there.As the linked issue states, this does indeed appear to be
len(self.varnames)(see this invariant in the CPython source)